All OS configuration (i.e. your installed packages, services, /etc content) happens in NixOS via a single configuration file in /etc/nixos/configuration.nix. When you do nixos-rebuild switch that file gets read and the OS gets rebuild, which in practice means some downloading and changing some symlinks, so it’s reasonably fast, kind of like GNU stow. The partition table isn’t touched here, that has to be setup manually on the first install like on every other distribution. NixOS will also not rollback the file system if you decide to boot into an older version, everything is done by symlinks and environment variables, so you don’t have to worry about your $HOME disappearing or anything like that.
For daily use that means that you basically never edit anything manually in /etc ever again, except for that one NixOS config file. You also can’t since everything will be symlinks into a read-only /nix/store. For permanent package installation you also need to edit the file and rebuild, you can’t do imperative stuff like apt install .... However with NixOS you don’t need to permanently install anything if you just want to try it, you can just do nix run nixpkgs#emacs or nix shell ...and it will run it without installing it (everything goes to the /nix/store/ cache and is garbage collected when no longer needed).
This can become a problem when you are dealing with third party packages that come as self extracting installer files that want to install themselves in /usr or depend on programs being available as /usr/bin/python or whatever, since on NixOS that whole hierachy is empty ( except for /usr/bin/env and /bin/sh). NixOS has buildFHSUserEnv to work around that and provide apps with a normal looking Linux filesystem, but that requires a bit more effort than the usual curl http://.../install.sh | sh hack.
By default $HOME isn’t touched at all and will behave largely like on any other distribution. You can however install packages as user via nix profile install (which behave much the same as apt would, but is local to your $HOME). The other popular alternative is home-manager, this provides basically the same what /etc/nixos/configuration.nix does, but for your $HOME, so you can start systemd services, generate your bash profile with it or install apps locally in your $HOME. Home-manager has to be enabled manually and is probably best ignored until you are familiar with the rest of the system. Home-manager is also less all-or-nothing than NixOS itself, so you can freely chose which dotfiles you want to manage manually and which you want to generate via home-manager.
As for nitpicks when it comes to daily use: Due to everything in NixOS being fully reproducible, NixOS makes little to no use of binary compatibility, meaning if libfoo changes, everything that depends on it has to change too. This requires a bit more downloading than other distributions. After an upgrade, NixOS will also keep two copies of everything around until you garbage collect them. This allows you to just go back to an older version via the boot manager. But it also means that you might need two or three times as much storage as on other distributions, at least until you garbage collect. But generally that’s a worthy trade-off unless you are on an extremely resource constrained system (anything >=32GB storage should be fine).
Finally, if in doubt, install the Nix package manager on whatever distribution you are using right now. You don’t have to go the full NixOS at once, you can install Nix packages on any Linux distribution and play around with it, similar to flatpak.
All OS configuration (i.e. your installed packages, services, /etc content) happens in NixOS via a single configuration file in
/etc/nixos/configuration.nix
. When you donixos-rebuild switch
that file gets read and the OS gets rebuild, which in practice means some downloading and changing some symlinks, so it’s reasonably fast, kind of like GNUstow
. The partition table isn’t touched here, that has to be setup manually on the first install like on every other distribution. NixOS will also not rollback the file system if you decide to boot into an older version, everything is done by symlinks and environment variables, so you don’t have to worry about your $HOME disappearing or anything like that.For daily use that means that you basically never edit anything manually in
/etc
ever again, except for that one NixOS config file. You also can’t since everything will be symlinks into a read-only/nix/store
. For permanent package installation you also need to edit the file and rebuild, you can’t do imperative stuff likeapt install ...
. However with NixOS you don’t need to permanently install anything if you just want to try it, you can just donix run nixpkgs#emacs
ornix shell ...
and it will run it without installing it (everything goes to the/nix/store/
cache and is garbage collected when no longer needed).This can become a problem when you are dealing with third party packages that come as self extracting installer files that want to install themselves in
/usr
or depend on programs being available as/usr/bin/python
or whatever, since on NixOS that whole hierachy is empty ( except for/usr/bin/env
and/bin/sh
). NixOS hasbuildFHSUserEnv
to work around that and provide apps with a normal looking Linux filesystem, but that requires a bit more effort than the usualcurl http://.../install.sh | sh
hack.By default
$HOME
isn’t touched at all and will behave largely like on any other distribution. You can however install packages as user vianix profile install
(which behave much the same asapt
would, but is local to your $HOME). The other popular alternative is home-manager, this provides basically the same what/etc/nixos/configuration.nix
does, but for your $HOME, so you can start systemd services, generate your bash profile with it or install apps locally in your $HOME. Home-manager has to be enabled manually and is probably best ignored until you are familiar with the rest of the system. Home-manager is also less all-or-nothing than NixOS itself, so you can freely chose which dotfiles you want to manage manually and which you want to generate via home-manager.As for nitpicks when it comes to daily use: Due to everything in NixOS being fully reproducible, NixOS makes little to no use of binary compatibility, meaning if
libfoo
changes, everything that depends on it has to change too. This requires a bit more downloading than other distributions. After an upgrade, NixOS will also keep two copies of everything around until you garbage collect them. This allows you to just go back to an older version via the boot manager. But it also means that you might need two or three times as much storage as on other distributions, at least until you garbage collect. But generally that’s a worthy trade-off unless you are on an extremely resource constrained system (anything >=32GB storage should be fine).Finally, if in doubt, install the Nix package manager on whatever distribution you are using right now. You don’t have to go the full NixOS at once, you can install Nix packages on any Linux distribution and play around with it, similar to flatpak.
Thanks for this write up.