Package management for nix-darwin

nix the brew.

One command to install, remove, search, and update packages across Nix and Homebrew on macOS. Declarative under the hood. Imperative at the surface.

curl -fsSL https://nex.styrene.io/install.sh | sh click to copy

or cargo install nex-pkg · nix profile install github:styrene-lab/nex

~
$ nex install htop bat eza
  + htop
  + bat
  + eza
>>> switching...
>>> done

$ nex install --cask slack
  + slack
>>> switching...
>>> done

$ nex remove htop
  - htop
>>> switching...
>>> done

How it works

One verb

nex install foo figures out the right config file, edits it, and runs darwin-rebuild switch. No manual file editing. No remembering which file.

Atomic rollback

Every edit is backed up before the switch. If the build fails, your config is restored automatically. No half-broken state.

Three tiers

nex install for Nix packages. --cask for GUI apps via Homebrew. --brew for formulae that need to stay in Homebrew. One tool, three backends.

Declarative truth

Under the hood, your packages live in .nix files checked into git. Reproducible across machines. Diff-able. Rollback-able. The config is the install state.

Usage

nex init Bootstrap nix-darwin + homebrew from scratch
nex install htop Install a Nix package
nex install --cask slack Install a GUI app via Homebrew
nex install --brew rustup Install a Homebrew formula
nex remove htop Remove from wherever it's declared
nex search "http" Search nixpkgs
nex list Show all declared packages
nex update Update flake inputs + rebuild
nex try htop Ephemeral shell, no install
nex rollback Revert to previous generation
nex switch Rebuild and activate
nex diff Preview what would change
nex gc Garbage collect nix store

Why nex?

Before

# Open the right nix file...
vim nix/modules/home/base.nix
# Add the package to the list...
# Save, exit...
darwin-rebuild switch --flake .#hostname
# Did it break? Check. Revert manually.

After

nex install htop