4 ms·
Nix has a fundamentally different approach to package management. Homebrew will install everything into `/usr/local/` or `/opt/homebrew` depending on your archi
by Cu3PO42 3y ago
Nix has a fundamentally different approach to package management. Homebrew will install everything into `/usr/local/` or `/opt/homebrew` depending on your architecture. From there, all installed software can discover all other installed software in a standard location. If, for example, you wanted to link 'mimalloc', you may find it in `/opt/homebrew/lib/mimalloc.so`. This is roughly how package management on Linux, BSD and presumably other Unices has always worked.
On the other hand, Nix installs software into `/nix/store/longhash-pkgname`. By default any given package is not aware of anything else you have installed, unless said package explicitly referenced the other during build time, including the exact version of the package.
This makes it possible for every package to get exactly the version of a dependency that it's known to work with and allows you to have different packages working with different versions of libraries. This makes Nix extremely reproducible: once a package works as intended, it will almost certainly continue to work no matter what else you change on your system.
On the other hand, I have experienced issues with my system after `brew upgrade`s on multiple occasions. Particularly related to Python upgrades.
I still use `brew cask` to install most GUI applications, since the repository for those on macOS is larger.
- paulsmith 3y agoIt's worth noting you can let Nix manage Homebrew for you, too. I do this on my MBP on which I have nix-darwin running, not for regular Homebrew formulae but for casks for GUI apps. In my configuration, I have this homebrew = { enable = true; onActivation = { autoUpdate = true; upgrade = true; }; casks = [ "inkscape" <other gui apps ...> ]; };
- JamesSwift 3y agoI achieve mostly the same on a non nix-darwin setup using vanilla home-manager: home.file."Brewfile" = { onChange = '' HOMEBREW_NO_AUTO_UPDATE=1 /usr/local/bin/brew bundle --file="$HOME/Brewfile" --cleanup --no-upgrade ''; text = '' cask '1password' ... ''; }
- Cu3PO42 3y agoExcellent point, thank you! I use that as well and intended to mention it and then I just forgot. Personally, I've been hesitant to turn on autoUpdate, have you found it to work well?
- boots22 3y agoYep, and we now have nix-homebrew, which installs homebrew for you as a flake input. Taps are also flake inputs so your apps versions get declaratively managed/locked too! Here’s how I do it: https://github.com/dustinlyons/nixos-config/blob/main/flake.nix https://github.com/dustinlyons/nixos-config/blob/main/flake....