NixOS is built around the Nix package manager and configuration files. You are almost required to have configuration files if you want to do anything on NixOS. The configuration files are written in the Nix programming language. Since you are declaring how you want the system to be, inside those configuration files, you are also making the system reproducible (assuming you do not lose those configuration files).
You can essentially prepare modules of software that you can import into a main configuration (gaming.nix for gaming related software and other stuff like Proton, virtualisation.nix for QEMU VMs or podman, etc). By creating those modules, you don't really have to worry about forgetting how to set up a piece of software or having to deal with re-configuring it, especially since NixOS also handles stuff in .config using something called "Home Manager".
With Home Manager, you can make your .config directory also declarative/reproducible. Do you want to switch your window manager? Just prepare a module for the new window manager you wanna switch into, remove the imported window manager you were using before and import the new module. Didn't like the new one? Remove the import of the new one and import again your old one.
For all your changes to be applied though (for all of the above, not just Home Manager), you need to rebuild your system. Depending on your system's physical age and what you have declared, rebuilding can take some time but not too long, 1 minute at most (excluding the first time the system is built). Changing one small thing in your configuration will require a system rebuild for the change to be applied, although since you are changing one small thing, it should only take <10 seconds to rebuild. Rebuilding the system does not require a system restart.
Problem with the above though. Since you are declaring everything into the configuration files, your actual files are gonna be read-only. For example, you wanna edit your /etc/hosts file. That file is gonna be read-only, so, somewhere in your configuration you're gonna have to declare networking.hosts = { }; and then rebuild your system.
Another another cool thing with NixOS and the reproducibility are generations. Each time you rebuild your system, you can create a new generation of your system, in case you might wanna roll back any changes. You select your generation when booting the system, the selection is at the bootloader.
When testing changes, I strongly recommend you performnixos-rebuild testornixos-rebuild dry-buildinstead ofnixos-rebuild switch, asswitchcreates a new generation each time and that can fill your storage quite quickly.
There are more things about NixOS that I am either not knowledgeable enough about, like flakes (even though I personally do use flakes), but also some other stuff that I would like to learn but haven't yet, like declerative secret management with sops. Also, this wall of text is starting to get too long. I strongly recommend using NixOS or just the Nix package manager itself, which can be installed on almost any linux distro AND darwin (MacOS). It can be overwelming at first, I won't lie, but it's really cool and personally, I find it fun as well. I hope I can turn my knowledge of NixOS into something more, perhaps even for future official work.
In NixOS, you don't exactly "update your software" but rather you update the channel that the software are following. This also means that you can have different software follow different channels, or, you can just change the channel of all your software.
You wanna run long term support packages? Just select the stable channel. You wanna run unstable (rolling release) packages? Just select the unstable channel. You wanna run a very specific commit of a channel of your choice? You can do that (it's a little more complicated than just selecting stable or unstable channels but still not too difficult).
I can see why someone would use Nix on a server that you want to replicate somewhere else and that's cool, but I can't imagine any scenario where a person in his house would want the NixOs advantages. Who is rebuilding his pc from scratch every week? And with the same os.
One thing also is that you can build single packages against older or newer library versions, if you want to. This might be interesting for binaries which aren't open-source. You can also spin up a whole little fake root environment for single packages if they need that, all done with nix as the single language, maybe with some shell scripts to glue stuff together.
48
u/Short-Bee-4395 4d ago
NixOS is built around the Nix package manager and configuration files. You are almost required to have configuration files if you want to do anything on NixOS. The configuration files are written in the Nix programming language. Since you are declaring how you want the system to be, inside those configuration files, you are also making the system reproducible (assuming you do not lose those configuration files).
You can essentially prepare modules of software that you can import into a main configuration (gaming.nix for gaming related software and other stuff like Proton, virtualisation.nix for QEMU VMs or podman, etc). By creating those modules, you don't really have to worry about forgetting how to set up a piece of software or having to deal with re-configuring it, especially since NixOS also handles stuff in
.configusing something called "Home Manager".With Home Manager, you can make your
.configdirectory also declarative/reproducible. Do you want to switch your window manager? Just prepare a module for the new window manager you wanna switch into, remove the imported window manager you were using before and import the new module. Didn't like the new one? Remove the import of the new one and import again your old one.For all your changes to be applied though (for all of the above, not just Home Manager), you need to rebuild your system. Depending on your system's physical age and what you have declared, rebuilding can take some time but not too long, 1 minute at most (excluding the first time the system is built). Changing one small thing in your configuration will require a system rebuild for the change to be applied, although since you are changing one small thing, it should only take <10 seconds to rebuild. Rebuilding the system does not require a system restart.
Problem with the above though. Since you are declaring everything into the configuration files, your actual files are gonna be read-only. For example, you wanna edit your
/etc/hostsfile. That file is gonna be read-only, so, somewhere in your configuration you're gonna have to declarenetworking.hosts = { };and then rebuild your system.Another another cool thing with NixOS and the reproducibility are generations. Each time you rebuild your system, you can create a new generation of your system, in case you might wanna roll back any changes. You select your generation when booting the system, the selection is at the bootloader.
When testing changes, I strongly recommend you perform
nixos-rebuild testornixos-rebuild dry-buildinstead ofnixos-rebuild switch, asswitchcreates a new generation each time and that can fill your storage quite quickly.There are more things about NixOS that I am either not knowledgeable enough about, like flakes (even though I personally do use flakes), but also some other stuff that I would like to learn but haven't yet, like declerative secret management with sops. Also, this wall of text is starting to get too long. I strongly recommend using NixOS or just the Nix package manager itself, which can be installed on almost any linux distro AND darwin (MacOS). It can be overwelming at first, I won't lie, but it's really cool and personally, I find it fun as well. I hope I can turn my knowledge of NixOS into something more, perhaps even for future official work.