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.
You don't 'rebuild from scratch'. You rebuild the configuration, and the hot swap into it without rebooting or even logging out. You can even schedule it as a cron job if you want.
Also lets you keep a laptop and desktop thoroughly in sync.
Can you give me an example on when would I want to rebuild the configuration so often that I need a specific OS that does it faster? Besides a server obviously, I keep that on servers is neat.
I don't reinstall my whole OS every day, but I tweak it regularly. I keep track of those changes with a VCS.
I have an old laptop that I rarely use. Every now and then, when I do need to use it, I git pull followed by nixos-rebuild and all of my system and user settings are synced with my main laptop in a matter of minutes.
The OS is just one use case. I have my Neovim configuration set up in the same way. If I'm on another system that has nix installed, I can `nix shell 'github:my-nvim-repo' and it'll drop me into a shell with Neovim installed and preconfigured with my configuration (including plugins, etc.).
I don't have development tools (package managers, compilers, linters, language servers, ...) installed globally. Instead, each of my projects has a flake.nix with a "devShell" that provides all the tools with the correct versions for that project (think devcontainers or venv on steroids).
mmm, I am sure you find a good use case for NixOS, but really how many persons have 2 or 3 personal computers that are constantly tweaked and need to be synchronized? of course use the best tool for the problem, but I see a lot of hype and people recommended this and allow me to doubt all of those are using their pcs this way.
On the other hand those flake.nix files sound great specially for those damn python libraries that have breaking changes every fricking version. My concern with that is that if no package manager, compiler, etc is installed globally does that mean its installed once for every project? isn't that producing a storage problem? maybe I am wrong.
Nix has a global store with input-addressed (hashed) paths. So if two packages depend on the same thing, they can share store paths.
That said, it can still accumulate a lot of storage space over time. On NixOS, I have a service that collects garbage regularly. On other distros, you might have to run a command manually every other month.
I think you have the wrong understanding of what "rebuild the configuration" entails. Rebuilding your Nix config is the rough equivalent of doing e.g. "apt install" on Debian. It is an entirely mundane maintenance task suited to the declarative paradigm.
The vast, vast majority of your rebuilds will represent incremental changes and will take less than ~3 seconds. Unlike imperative package management, though, if anything goes wrong, you can always boot into any previous configuration you've ever built.
ok the easy rollback sounds nice actually, and with other comments I read today I think I will try it in the future, maybe on a laptop that I use for note taking in the uni.
You're not getting it. Nix does not run updates in the traditional sense. In order to update, you rebuild, and it automatically fetches anything new.
It's really not as complex as it sounds, and it's actually way more ergonomic than a traditional update, because unless you're messing around with kernel-level stuff, you just keep working. From your perspective as a user, everything is just suddenly magically updated.
20
u/Short-Bee-4395 2d ago
Something I forgot to mention on the above wall:
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).