News for hackers. Stuff that matters.
Re:Nix Survival Mode: macOS upgrades won't break Nix anymore by Cu3PO42 on Wednesday October 25, 2023 @02:00PM (#38015963)
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.

Re:Nix Survival Mode: macOS upgrades won't break Nix anymore by paulsmith on Wednesday October 25, 2023 @02:20PM (#38016275)
It'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 ...> ];
  };
Re:Nix Survival Mode: macOS upgrades won't break Nix anymore by JamesSwift on Wednesday October 25, 2023 @02:24PM (#38016327)
I 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'
      ...
    '';
  }
Re:Nix Survival Mode: macOS upgrades won't break Nix anymore by Cu3PO42 on Wednesday October 25, 2023 @02:24PM (#38016333)
Excellent 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?
Re:Nix Survival Mode: macOS upgrades won't break Nix anymore by boots22 on Wednesday October 25, 2023 @02:50PM (#38016720)
Yep, 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....