I first tried out Nix in 2018.
The second round — I went through “Nix Pills”, which helped get a better idea of what was going on — was in 2020.
I heard NixOS getting some popularity (you know when the “Arch folks” are talking about it …), and thought I’d try — not the OS, not yet — the Nix-package-on-a-VPS experience again.
I had, I’ll admit, forgotten some of my intuitive grasp from three years ago.
Context
All I wanted to do was to install Emacs.
It turned out to be much harder than I expected.
Here are some things that partially or didn’t work:
Searching and installing
What didn’t work:
nix search emacs
What did work:
nix search nixpkgs emacs
However, this shows a result like legacyPackages.x86_64-linux.emacs29
Note: it’s not obvious whether that legacyPackages
prefix is a good thing, a bad thing, a neutral thing …
What doesn’t work:
nix install legacyPackages.x86_64-linux.emacs29
nix install emacs29
nix install nixpkgs emacs29
Using nix-env
AFAICT I should’ve been able to use the “new” nix
CLI, and not had to fall back to nix-env
… but nope.
Something that becomes very obvious when you try to use nix-env
…. it takes forever.
If you’re used to apt cache ...
returning quickly, this is 10x or even 100x slower.
What didn’t work:
nix-env --install legacyPackages.x86_64-linux.emacs29
nix-env --install emacs29
nix-env --install nixpkgs.emacs29
Note: that last one is very similar to what finally worked !
Using flakes
This kept popping up, but I didn’t try it. I don’t know if it would’ve been faster with it or not. But surely, I can’t be expected to create a whole file describing what I want to install instead of running a one-line install command?! Especially after I’ve searched for it and verified that it exists?! (i.e. the nix search ...
above)
Here is what finally worked:
nix-env -iA nixpkgs.emacs29
Between searching, forum posts, and Bard, there was no way I’d have “normally” arrived at this.
Closing notes
To be clear, this won’t stop me using Nix — but I expect it’s enough of friction that I think blocks wider adoption.
At a minimum, allowing something like nix install foo
to just work after nix search foo
has succeeded would be a worthy goal.