Declarative Nix configuration for macOS (Apple Silicon supported), using nix-darwin, home-manager, and sops for secrets and dotfiles.
This configuration supports Apple Silicon Macs.
xcode-select --installThanks to the installer by Determinate Systems!
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- installAfter installation, open a new terminal session to make the nix executable available in your $PATH.
⚠️ IMPORTANT The installer will ask if you want to install Determinate Nix. Answer No.
The hostname should match the one set in the flake.nix file.
Alternatively, you can change the hostname in flake.nix to match your machine's actual hostname.
ssh-keygen -t ed25519 -C "[email protected]"mkdir -p ~/.config/sops/agenix run nixpkgs#ssh-to-age -- -private-key -i .ssh/id_ed25519 > ~/.config/sops/age/keys.txtnix shell nixpkgs#age -c age-keygen -y ~/.config/sops/age/keys.txtExample: to get your private key from ~/.ssh:
bat --plain id_ed25519sops -e secrets/flow48/secrets.yaml > secrets/flow48/secrets.enc.yaml
⚠️ IMPORTANT After encrypting, removesecrets.yamlto avoid accidentally committing it to Git.
If you see:
Cannot read ssh key '/etc/ssh/ssh_host_rsa_key': no such file or directory
Cannot read ssh key '/etc/ssh/ssh_host_ed25519_key': no such file or directory
Run:
sudo ssh-keygen -ATo copy your public key from ~/.ssh:
bat --plain id_ed25519.pubUse the rebuild alias.
- By default, it should be your hostname replace
<<hostname/profile>>with your hostname
nix --extra-experimental-features 'nix-command flakes' build ".#darwinConfigurations.<<hostname/profile>>.system"Use the rebuild alias.
- By default, it uses your hostname
- You can also pass a specific profile:
rebuild mac-proCheck the custom-dock file in the hosts/darwin directory — it defines the default Dock apps.
Includes a custom theme, Starship prompt, and keybindings.
Set the font manually to: MesloLGLNF
- Should be activated with your license.
- After activation, launch the LuLu app and block CleanShot’s network access to prevent license checks (useful if reusing a license across machines).
⚠️ IMPORTANT This also disables CleanShot’s cloud functionality.
While NodeJS and tools like @aws-amplify/cli can be installed declaratively via Home Manager, global packages can’t be uninstalled via Nix.
npm uninstall -g @aws-amplify/clirm -rf ~/.npm-global/lib/node_modules/@aws-amplify
rm ~/.npm-global/bin/amplifySome apps are installed but require manual configuration after the first launch:
- MiddleClick
- HiddenBar
- AltTab
- BetterDisplay
Settings must be imported manually from:
data/raycast/*
You can define an alias in shell config data/mac-dot-zshrc like this:
rebuild() {
local host="${1:-$(hostname)}"
sudo darwin-rebuild switch --flake ".#$host"
}To update your dependencies and rebuild your system, you can use the following command:
nix flake update
rebuild