Похожие презентации:
NixOS еще не умер
1. NixOS еще не умер
Муравьев МаксимDevSecOps инженер
YADRO
Homelab
Meetup`25
2. Зачем?
3. Проблемы, с которыми я столкнулся
Dependency hellBroken updates
$ scp docker-compose.yaml user@someserver:~
$ ssh user@someserver
user@someserver $ vim docker-compose.yaml
Manual configuration
Can't remember how I did that..
4. Требования к Homelab
• Безопасные обновления• Удобное обновление всех хостов из одной точки
• Единая точка конфигурации с
шаблонами/модулями/профилями
• Возможность отката к предыдущим версиям
5.
Nix ecosystem6.
С чего все началосьedolstra.github.io/pubs/phdthesis.pdf
7.
Nix это?..• Nix lang – pure
functional DSL
• Nix PM – package
manager
• Nix OS – linux based OS
with Nix PM
8.
Nix langPure functions
Lazy calculation
Immutable
9.
Nix lang5
4
Primitives / literals
1
6
7
3
2
Functions
10.
Nix PM11.
Nix PMAs a file
Interactive
12.
Nix PM• Non Filesystem Hierarchy Standart
(Non-FHS)
• Use hashes for every package
• Use symlinks for access outside /nix/store
13.
Nix PM14.
Nix PMgithub.com/NixOS/ni
xpkgs
15.
Nix PM16.
Nix PMStore derivation
Derivation output
Nix expression
17.
Nix PM• 667M objects & 425 TB cache
(in 2023)
• Used for unstable/releases
branches
18.
Nix PM19.
Nix PMNixhub.io
20.
Nix OS21.
Nix OS• System from one file
• Nix Lang for configuration
• Many options for use (over 20K)
22.
Nix OS• Add new service in configuration
• Add packages by user
• Add package by system-wide
23.
Nix OS• Nix download binaries
and run services
• Nix create new
generation of system
24.
Nix OS• Vim available only for one
user
• Ripgrep available for all
users
25.
Nix OS• Simple rollback in 1
command
• We have previous state of
system
26.
Nix OSImport it
Create module
27.
Nix OSUse it
Create module with custom options
28.
Nix OSNIXOS IS NOT
REPRODUCIBLE
(by default)
Npins
29.
Nix OS• They exist in Nix PM, but are marked as
experimental
• Used in official package repo
• Most community used
30.
Nix OSHow to use flakes?
1. Add nix settings in
configuration
2. Switch system
3. Create flake.nix file
4. Import host configuration
5. Switch system
31.
Nix OSNow we have reproducible
system?
32.
Nix community – diskoOfficial logo xD
sudo nix run 'github:nixcommunity/disko/latest#disko-install' -- -flake .#my-nixos –disk my-disk /dev/sda
33.
Nix community – nixos-anywherenix run github:nix-community/nixos-anywhere -- --flake .#my-nixos
--target-host root@<some-ip>
1. Connect to remote server via ssh
2. Use kexec to boot into nixos-installer
3. Use disko to format disks
4. Install NixOS
34.
NixOSDeploy just via ssh lol
nixos-rebuild switch –flake .#mynixos –target-host username@ip –build-host someuser@som
--flake – select host configuration
--target-host – select target machine
--build-host – select remote builder host
--use-remote-sudo – to apply configuration if you deploy user non-root
35.
Nix community – deploy-rs1. Import deploy-rs module
2. Declare deploy settings for target hosts
3. nix run github:serokell/deploy-rs your-flake
4. …
5. Done
36.
Virtual MachinesProxmox-nixos
Microvm-nix
37.
ContainersNixos containers
OCI containers
38.
Nix topologyNix topology scheme
Declare with nix
39.
Nix ecosystemRabbit hole
40.
Nix ecosystem +1. Декларативность и наглядность (что в git, то и на машине)
2. Воспроизводимость
3. Возможность откатов
4. Решен ад зависимостей
5. Огромной репозиторий с пакетами
6. Очень просто вносить изменения в софт (патчи, оверлеи, …)
7. Можно собирать софт из исходников при необходимости
8. Быстрое развертывание хоста
9. Просто управлять большим количеством хостов
10.Это не ансибл, тут нет стейта, "идемпотентности" и ямла
41.
Nix ecosystem 1. Порог входа2. Nix DSL узко специализированный язык
3. Непонятные трейсы об ошибках
4. Нетривиальные ошибки (infinity recursion counter, …)
5. Недостаточная документация
6. Нет LTS NixOS
7. Не все ПО умеет работать без FHS
8. Работа с секретами нетривиальная
9. Скандалы в коммьюнити
42.
NixOS еще не умерВесна 2024
Осень 2025
t.me/nix
alt
43.
ThanksGitHub Repo
Tg Blog