4 ms·
Something that isn't stated in this thread yet is how easy NixOS makes version upgrades. I maintain multiple pet servers. When I used Ubuntu, doing release upg
by nh2 4y ago
Something that isn't stated in this thread yet is how easy NixOS makes version upgrades.
I maintain multiple pet servers. When I used Ubuntu, doing release upgrades cost me ~6 hours per server per upgrade every 2 years. Most of that time went into merging updated upstream configuration files with my changed configuration files, often for silly stuff like upstream changing tabs to spaces in the config file syntax. With the Debian-style upgrader, you also have to wait 5 minutes until you're prompted for the next config file to merge, while other packages are "configuring" with `dpkg`. So you cannot do them all in a batch, but have to stare at the screen throughout the procedure, attending every 5 minutes.
So with multiple servers that was multiple days of upgrades per year.
With NixOS, these days are is reduced to minutes.
For example, on one of my servers I upgraded just now:
18:07 -- starting NixOS 21.05 -> 21.11 upgrade command
18:10 -- download finished
18:10:15 -- rebooted into new running system
This server currently runs:
* webserver
* mailserver (with web UI, spamfilter, etc)
* nameserver (with dynamic DNS updates)
* VPN server
* mumble voicechat server
* XMPP server
* Matrix server with signal bridge
* vaultwarden server
* some custom web services
This is possible because with NixOS, you do not mutate text files in `/etc` for configuration. Instead, you write a structured config similar to a JSON object (but in the Nix language, so you can use stuff like `map` and `filter` to solve repeated tasks over e.g. all the domains in your web server). This config only contains the differences from the default config. So concepts like "does the upstream Apache config file indent with tabs or spaces" no longer play any role.
For the server above, the config file is 800 lines long, of which 200 are comments.
So NixOS is saving me multiple days per year in sysadmin tasks, which is pretty good!
- mrslave 4y agoAgreed. When I'm selling Nix to other Linux users, instead of getting lost in an explanation of deterministic package versions, I tell them system upgrades are atomic: you either enter the new environment or you don't. Either way you're in a consistent state. If for some reason there's difficulty booting, you can always go back to the previous system state from the boot menu. Mostly Debian and Gentoo users have nibbled on this bait. Arch users less so. YMMV
- SuperSandro2000 4y agoI always forget to explain that. Atomic updates are one of the best if not the best feature of nixos.
- neil-mayhew 4y agoIt's even better than reverting the whole system because you can still run an executable from the old system in the new system. Once, I found out that video had stopped working for me in Zoom but because I hadn't used it in a while there had been multiple system updates since then. I was able to bisect through the previous system profiles and find the most recent version that still had working video. I used this for a month or so until the bug was fixed in the current version.
- ttarr 4y agoHow about isolation, how do you manage that? Are services ran under different containers, VMs or namespaces?
- nh2 4y agoNo. A main reason people use containerisation is to work around the problem that different versions of libraries and binaries cannot coexist in classical Linux distributions. This problem does not exist in NixOS. The services are declared as NixOS modules, which manifest as plain systemd services on the server. Systemd has its own set of options for resource/security isolation, and some NixOS modules use them where possible, for example: https://github.com/NixOS/nixpkgs/blob/8d559672bedd54034b711dedb7f3fd19b41ce88d/nixos/modules/services/monitoring/grafana.nix#L674-L706 https://github.com/NixOS/nixpkgs/blob/8d559672bedd54034b711d...