Configuration for my personal machines, using Nix. I wrote about the early days in a blog post.
| Host | What | Platform | Apply with |
|---|---|---|---|
pearwin-laptop |
Personal MacBook | aarch64-darwin | darwin-rebuild |
kazooie |
Asus ROG Xbox Ally X | x86_64-linux | colmena apply |
Standalone Home Manager profiles are also available: apearwin for macOS and apearwin-ci for the Linux CI runner.
The flake follows the dendritic pattern.
Every .nix file under modules/ is a flake-parts module, loaded automatically by import-tree.
Paths containing /_ are skipped; this is where plain NixOS modules and package definitions belong.
A feature defines modules for the classes it needs, by name:
# modules/programs/fish.nix
{
flake.modules.homeManager.fish.programs.fish.enable = true;
flake.modules.darwin.fish.programs.fish.enable = true;
}Home Manager features are automatically available under the same name to NixOS and nix-darwin hosts through
home-manager-aspects.nix.
Hosts import the home-manager feature and list the other features they need:
# modules/hosts/pearwin-laptop.nix
{ config, ... }:
{
hosts.pearwin-laptop.system = "aarch64-darwin";
flake.modules.darwin.pearwin-laptop = {
imports = with config.flake.modules.darwin; [ home-manager macos fish git ];
# Other host settings go here.
};
}hosts.nix turns each hosts.<name> declaration into a system configuration, a check, and (for NixOS) a Colmena node.
personal.nix composes the same Home Manager features for the standalone profiles.
macOS-specific user configuration lives in the Home Manager features too, so standalone profiles retain it.
Install Nix with flake support, for example using the Determinate Systems installer, and clone this repository.
nix develop provides Colmena and agenix.
For a system managed by nix-darwin, the first activation is:
sudo nix run nix-darwin/master#darwin-rebuild -- switch --flake .#pearwin-laptopAfterwards:
sudo darwin-rebuild switch --flake .#pearwin-laptopAlternatively, use Home Manager alone:
nix run home-manager/master -- switch --flake .#apearwinTell Hammerspoon where its configuration lives:
defaults write org.hammerspoon.Hammerspoon MJConfigFile "${XDG_CONFIG_HOME:-$HOME/.config}/hammerspoon/init.lua"colmena apply --on kazooieThe host builds on the target.
The standard nixosConfigurations.kazooie output remains available for nixos-rebuild and installation tools.
nix flake update
nix flake update nixpkgs-kazooie # update only the handheld's package set
nix fmt -- --ci
nix flake check --all-systems --no-build
python3 -m unittest discover -s testsnixpkgs-ai follows nixpkgs by default and supplies pkgs.unstable for features that need an independently overridable tool package set.
CI checks formatting, evaluates every system and standalone profile, runs the composition tests, and builds the Linux Home Manager activation package without activating it on the runner.
scripts/drv-paths.sh prints the checked derivations.
When refactoring, compare before and after with scripts/drvdiff.py OLD.drv NEW.drv.
Its reordering classification is a review aid, not proof of semantic equivalence.
Personal secrets are encrypted with agenix to the public keys listed in secrets/agenix-rules.nix:
cd secrets && RULES=agenix-rules.nix agenix -e <name>.ageTo use Nix-managed fish as the macOS login shell, add its path to /etc/shells and run chsh -s <path>.
With nix-darwin the path is /run/current-system/sw/bin/fish; with standalone Home Manager it is ~/.nix-profile/bin/fish.