macOS Nix First Taste

Long gone Homebrew. My first experience with Nix on macOS.

Note

Note that this blog currently acts as a reference for me. It is not a comprehensive guide on why and how to use Nix on macOS.

I chose nix mainly because I am tired of Homebrew’s slowness.

Install

I am not using the official installer because it cannot survive macOS updates. Instead, I am using the Determinate System’s Nix Installer.

1
2
3
4
5
6
7
ARCH=$(uname -m | sed 's/arm64/aarch64/')
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
curl -L -o nix-installer https://github.com/DeterminateSystems/nix-installer/releases/latest/download/nix-installer-$ARCH-$OS
chmod +x nix-installer
# Optionally, move nix-installer to your PATH
# sudo install nix-installer /usr/local/bin
./nix-installer install --explain

Pin Nixpkgs

I don’t want to download a tarball and extract it every now and then. I know you can set tarball-ttl to a higher value, but I don’t want to do that either. Just pin nixpkgs.

1
nix registry pin nixpkgs

Using

I wrote some scripts just to make my life easier.

Later Steps

There is nix-darwin to make declarative configuration easier. I don’t have time to try it yet but I will definitely give it a try when I have time.

Licensed under CC BY-NC-SA 4.0
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy