3 ms·
Nix is probably the slowest and is missing many packages. It's Kool-Aid for the cool kids. MacPorts was good until everyone started using Homebrew. Homebrew has
by eddieh 5y ago
Nix is probably the slowest and is missing many packages. It's Kool-Aid for the cool kids. MacPorts was good until everyone started using Homebrew. Homebrew has some weird quirks that drive me crazy, but it mostly works and is up to date. I tried pkgsrc and liked it, but a few common packages were weirdly named and it didn't have some Mac specific stuff.
Some new package manager that's a mix of pkgsrc, brew, and MacPorts would be awesome. Especially if portable and could somehow also replace nvm, rbenv, pythonenv, and things of that nature.
- pxc 5y ago> 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 '<nixpkgs>' -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 <snip> * legacyPackages.x86_64-linux.libreoffice (7.0.4.2) Comprehensive, professional-quality productivity suite, a variant of openoffice.org <snip> ________________________________________________________ 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 '<nixpkgs>' -iA libreoffice installing 'libreoffice-7.0.4.2' these paths will be fetched (153.59 MiB download, 574.57 MiB unpacked): <snip> 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-managers-are-slow/ https://michael.stapelberg.ch/posts/2019-08-17-linux-package...
- pxc 5y agotl;dr: Homebrew actually takes several times as long to install packages as Nix does, and uses up way more space despite a less isolated toolchain. Now that I'm on my Ubuntu system, I can easily test Nix and Homebrew side-by-side. To make it fair, I've removed almost everything I have installed with Nix, as well as Homebrew. Interestingly, Homebrew is using ~2x as much disk space, and listing my installed packages (none) with Homebrew takes ~30x as long as with Nix: ~ du -hsxc /nix/store /home/linuxbrew 238M /nix/store 584M /home/linuxbrew 822M total ~ time nix profile list ________________________________________________________ Executed in 19.88 millis fish external usr time 11.21 millis 174.00 micros 11.04 millis sys time 11.18 millis 141.00 micros 11.04 millis ~ time sudo -H nix profile list 0 flake:nixpkgs#legacyPackages.x86_64-linux.nixFlakes github:NixOS/nixpkgs/b2f2d04f01b3de3abad0dd9bc48ad7a3ee32bbc6#legacyPackages.x86_64-linux.nixFlakes /nix/store/g4xva7x46h5bqqh811n12dzjc7325x21-nix-2.4pre20210326_dd77f71 1 flake:nixpkgs#legacyPackages.x86_64-linux.starship github:NixOS/nixpkgs/b2f2d04f01b3de3abad0dd9bc48ad7a3ee32bbc6#legacyPackages.x86_64-linux.starship /nix/store/5n36vabqg701l9nji30m1r004zcy4q0w-starship-0.51.0 ________________________________________________________ Executed in 29.91 millis fish external usr time 27.30 millis 380.00 micros 26.92 millis sys time 4.72 millis 283.00 micros 4.43 millis ~ time brew list ==> Formulae ________________________________________________________ Executed in 881.81 millis fish external usr time 527.24 millis 411.00 micros 526.83 millis sys time 173.15 millis 298.00 micros 172.85 millis Homebrew takes about twice as long to search for packages related to Libreoffice (results omitted to HN won't tell me this post is too long): ~ time nix search nixpkgs libreoffice >/dev/null ________________________________________________________ Executed in 554.37 millis fish external usr time 537.39 millis 434.00 micros 536.95 millis sys time 16.44 millis 289.00 micros 16.15 millis ~ time brew search libreoffice >/dev/null ________________________________________________________ Executed in 1.33 secs fish external usr time 578.16 millis 0.00 micros 578.16 millis sys time 124.57 millis 367.00 micros 124.20 millis I had some trouble looking for large packages to install with Homebrew and Nix for comparison. It seems that GUI apps (Libreoffice, Firefox, etc.) tend to be packaged exclusively as casks for Homebrew, which means they don't exist on Linux. So instead, I selected a handful of packages from the Linux formulas list[1] that I figured would pull in a substantive dependency closure. Apparently there's no bottle for Crystal, so it took a very long time to install because it had to compile from source. Prior to that, though, installation crashed because of a ulimits issue when ‘pouring the bottle’ for LLVM: ~ time brew install imagemagick bat feh crystal python mruby ==> Downloading https://ghcr.io/v2/linuxbrew/core/zlib/manifests/1.2.11 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/linuxbrew/core/zlib/blobs/sha256:6f604280b9e056da163b81cef3076b2e39bbd2b8d3cc8c36d27c19c472c760a4 ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:6f604280b9e056da163b81cef3076b2e39bbd2b8d3cc8c36d27c19c472c760a4?se=20 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/linuxbrew/core/libpng/manifests/1.6.37 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/linuxbrew/core/libpng/blobs/sha256:c5d219b27780c730af50693110ed2c79e50200d3595c7e395998fe3950354ec9 ==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:c5d219b27780c730af50693110ed2c79e50200d3595c7e395998fe3950354ec9?se=20 ######################################################################## 100.0% ==> Downloading https://ghcr.io/v2/linuxbrew/core/bzip2/manifests/1.0.8-1 ######################################################################## 100.0% <snip> ==> Installing crystal dependency: llvm@9 ==> Pouring llvm@9--9.0.1_5.x86_64_linux.bottle.tar.gz Error: Too many open files @ rb_sysopen - /home/linuxbrew/.linuxbrew/Cellar/llvm@9/9.0.1_5/bin/llvm-jitlink ________________________________________________________ Executed in 600.02 secs fish external usr time 203.24 secs 479.00 micros 203.24 secs sys time 70.80 secs 313.00 micros 70.80 secs I decided to re-run the brew install command, but skip Crystal, which only took a few more seconds: ~ time brew install imagemagick bat feh python mruby <snip> ==> Installing mruby ==> Pouring mruby--3.0.0.x86_64_linux.bottle.tar.gz /home/linuxbrew/.linuxbrew/Cellar/mruby/3.0.0: 323 files, 14.7MB ________________________________________________________ Executed in 20.18 secs fish external usr time 9.56 secs 0.00 micros 9.56 secs sys time 3.06 secs 761.00 micros 3.06 secs I left Crystal in when I tested Nix, since I knew it would be no problem, and Nix was done in ~36 seconds, meaning Homebrew ~17x the time, skipping one package entirely. After the two install operations, Homebrew was using several more gigabytes of storage than Nix: du -hsxc /nix/store /home/linuxbrew 2.0G /nix/store 4.9G /home/linuxbrew 6.8G total I'll reply to this comment with a ‘warmed-up’ test of installing a single additional package, as well. But it seems pretty clear already that it's misleading at best to characterize Homebrew as faster than Nix. — 1: https://formulae.brew.sh/formula-linux/ https://formulae.brew.sh/formula-linux/