> Nix is probably the slowest
Nix evaluation can be slow sometimes, but installation is generally relatively fast, since everything in Nix is fully parallelizable. It's generally several times faster than apt, for installs that involve multiple large downloads, for example, and historically it's also faster than pacman.[1] (I think this is probably no longer the case with Pacman 6.0, which finally parallelizes downloads. In that case Nix evaluation time probably dominates.)
I imagine what you're identifying as slow is searching through Nix packages. On the old/stable release of Nix, you use something like `nix-env -qaP` for this, and that requires evaluation of every package in Nix, and can take a long time. `nix search`, however, is extremely fast on the unstable releases of Nix.
A Nix search using the old method is extremely slow, > 7 seconds:
I ~ time nix-env -f '' -qaP libreoffice
libreoffice libreoffice-7.0.4.2
libreoffice-still libreoffice-7.0.4.2
libreoffice-still-unwrapped libreoffice-7.0.4.2
libreoffice-fresh libreoffice-7.1.2.2
libreoffice-fresh-unwrapped libreoffice-7.1.2.2
libreoffice-qt libreoffice-7.1.2.2
________________________________________________________
Executed in 7.31 secs fish external
usr time 6.79 secs 335.00 micros 6.79 secs
sys time 0.52 secs 67.00 micros 0.52 secs
A Nix search using the new method, which leverages cached evaluation of Nixpkgs, takes about half a second:
nix-shell -p nixUnstable --run fish
time nix search --experimental-features 'nix-command flakes' nixpkgs libreoffice
* legacyPackages.x86_64-linux.libreoffice (7.0.4.2)
Comprehensive, professional-quality productivity suite, a variant of openoffice.org
________________________________________________________
Executed in 576.30 millis fish external
usr time 561.00 millis 252.00 micros 560.75 millis
sys time 16.07 millis 55.00 micros 16.01 millis
And installation, in either case, is pretty fast. It takes a few second to install, for example, Libreoffice on my system, with the vast majority of the time taken up being the download:
time nix-env -f '' -iA libreoffice
installing 'libreoffice-7.0.4.2'
these paths will be fetched (153.59 MiB download, 574.57 MiB unpacked):
copying path '/nix/store/8yq9h91bsbgi62dhvh4xfqxvhq58b5y4-libreoffice-7.0.4.2' from 'https://cache.nixos.org'...
building '/nix/store/nhmf4ak414lrzy3387kbsx8brm8hckds-user-environment.drv'...
created 68 symlinks in user environment
________________________________________________________
Executed in 21.32 secs fish external
usr time 1.34 secs 0.00 micros 1.34 secs
sys time 0.43 secs 521.00 micros 0.42 secs
(I tried for a bit to get Linuxbrew installed so I could test the same functionality with it, but Homebrew isn't portable enough to work on NixOS, since it hardcodes a ton of command and interpreter paths to files that don't exist on some distros.)
—
1: https://michael.stapelberg.ch/posts/2019-08-17-linux-package...