* It makes it trivial to have multiple versions of the same package installed at the same time and allows you to switch between them at will.
* It is trivial to roll back your system after a failed upgrade. Difficult system recovers after you upgrade to a new unstable version are a thing of the past.
* Non-privileged users can install software completely securely.
* Projects packaged with nix have the best possible build reproducibility because nix accounts for ALL of your dependencies all the way down to the lowest level system libraries, compilers, etc.
In a nutshell, it's a purely functional Linux distribution. That means all changes you make to your system are non-destructive. For example, you can always roll back to a previous OS state, which is represented by a hash computed from all packages installed, and all options you've set. In turn, package hashes are computed from the package sources and all inputs (buildtime and runtime package dependencies).
But it's a great platform for fearless experimentation, because it's so easy to revert any change you later decide was undesired.
It's also the most convenient system I ever worked with for creating custom packages, which is lucky, because NixOS does have fewer pages compared to other distributions.
It's not bad, though: https://repology.org/repository/nix_stable
Haskell and R packages will be added soon to give a more complete picture.
But as I said, it's all in all really nice to work with Nix.
Is Arch Build System one of the systems you've ever worked with? (I found ABS very convenient.)
(I already get that the design of NixOS prevents the system's ending up in an incoherent state, which will happen on Arch eventually if you wait long enough between upgrades.)
One of the nice things is that you can install many things without having to sudo - the build is run by a daemon and sandboxed. nix-shell can also be used to create a shell in which a given package set is installed - you can use that to use a piece of software as a one-off or create a development environment that doesn't pollute your general system. Tools like home-manager[0] can help with managing your home directory in a similar way to NixOS's management of your system, too - I have redis and postgres installed using home-manager to run as my own user on demand under systemctl.
My experience is mostly with deb and rpm before Nix.
So maybe the Arch maintainers got more disciplined, or maybe I just got better at not breaking things. Probably both.
- No separate AUR that some packages are arbitrarily located in
- Not having to care about binary packages: they are just transparently downloaded and used if available
Pacaur makes the AUR a bit more palatable, but you still notice the split.
I've been using NixOS more or less exclusively for ~2.5 years now. Whenever I want to run software on NixOS which is not already in Nixpkgs, I package it (if I want it bad enough). This week, for example, I packaged KSmoothDock so that I could try it out.
This is the whole thing:
{ mkDerivation, lib, fetchFromGitHub
, cmake, extra-cmake-modules
, plasma-framework, kwindowsystem }:
let
version = "5.9";
in
mkDerivation {
name = "ksmoothdock-${version}";
src = (fetchFromGitHub {
owner = "dangvd";
repo = "ksmoothdock";
rev = "v${version}";
sha256 = "1fbghyd079xk4q5na8msna5zkfg85c4ksyfqy524v2pm96dyl2dr";
} + "/src");
nativeBuildInputs = [
cmake
extra-cmake-modules
];
buildInputs = [
plasma-framework
kwindowsystem
];
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace /usr/share/ share/
'';
}
It didn't feel like much work and I think it only took a few minutes. In this case, I was able to base the package definition on another 3rd-party dock for Plasma, so it was even easier than usual to get started. I just copied the other package and changed the package name and location of the source code, and everything worked. I then cleaned up by consulting the README for the project and removing as many extraneous dependencies as possible, and smoothed over a quirk, which was pretty painless.Once you get a feel for the docs (and the Nixpkgs source, just because it's a treasure trove of examples), packaging for/with Nixpkgs is usually pretty easy, and the results pretty readable.
I should also add that the range of packages already included also seems to me to have improved a great deal over the years that I've been using NixOS. And I think once NixOS gains support for Snap packages and Flatpaks (the latter is in the works and has been making good progress recently), it will become a much more viable desktop OS for those unwilling or unable to deal with packaging the odd missing application.
If something fails, you can always rollback to a previous revision, and since everything is there, you know your whole system will be working.
If you want to reproduce your system, you can copy the whole content and "checkout" the relevant revision on the new system. Because the hash is the same, every single bit underneath will be the same.
Like Docker, but it uses install scripts instead of layered images.
Docker scripts that e.g. clone a remote and build from the HEAD are not reproducible. Another example would be downloading fancysoftware-latest.tgz
Nixos will have you either pull from a specific git commit, or will hash the sources, so the default behavior is reproducible.