Configurations of my system (or systems, depending on where one draws boundaries), managed almost entirely with Nix.
This setup is evolving fast, due in part to Darwin. This page will be updated with finer details as the configuration settles.
To be run from the root of this directory, unless otherwise stated.
home-manager switch --flake .#paul
(optionally add --show-trace
for crazy error messages, or --dry-run
to have a preview of results)
e.g. Âsâra, my favourite MacBook Pro (sans diacritics for Nix files...)
nix build .#darwinConfigurations.Asara.system
The manual installation process is worth knowing about to understand the changes that nix-darwin
makes to a MacOS system.
These are the steps followed here (on MacOS Ventura 13.2).
- Note 1: the
configuration
parameter innix-darwin
'sdefault.nix
should be swapped out for whichever configuration(.nix
) file is being used for the device (e.g.Asara.nix
). - Note 2: move any existing
/etc/nix/nix.conf
file and backup if need be.
# add `darwin` to the nix channels & update
nix-channel --add https://github.com/LnL7/nix-darwin/archive/master.tar.gz darwin
nix-channel --update
# declare `run` synthetic object on root volume
echo -e "run\tprivate/var/run" | sudo tee -a /etc/synthetic.conf
# 'stitch and create' the synthetic object
/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util -t
# bootstrap nix-darwin from it's `default.nix` (see note above)
nix-build -A system --no-out-link
# use the link returned to run the build, then switch
sudo <result-link>sw/bin/darwin-rebuild build -I darwin-config=../Devices/Asara.nix
sudo <result-link>sw/bin/darwin-rebuild switch -I darwin-config=../Devices/Asara.nix
or, the last two commands can be done using the flake in at the root of this directory, like so:
darwin-rebuild build --flake .#
darwin-rebuild switch --flake .#
...which is desirable, since this is aiming to be a flake-first setup.
... we want to get the useful stuff out of the old nix.conf
:
build-users-group = nixbld
trusted-users = root paul
# builders -- for details, see:
# https://nixos.org/manual/nix/stable/advanced-topics/distributed-builds.html
builders = ssh://nemo aarch64-linux,x86_64-linux,wasm32-wasi ~/.ssh/id_ed25519 8 2 ;