Nix flake that manages user environments with home-manager and, on macOS, system settings with nix-darwin. It targets three machines:
| Host | System | User | Notes |
|---|---|---|---|
AstuteMBP |
aarch64-darwin |
astutecat |
macOS, uses nix-darwin + homebrew |
astutecachy |
x86_64-linux |
astutecat |
Linux desktop, genericLinux |
nb0408 |
x86_64-linux |
willrog |
Work machine, genericLinux + sway |
Config is split as follows:
flake.nix- inputs, dev shell, and output definitions (homeConfigurations,darwinConfigurations).home/- shared home-manager modules imported by every host.hosts/<host>/- per-hosthome.nix/darwin.nix.configs/- individual program configs (shell, git, editors, terminals, etc.).editors/- Helix, Zed, Doom Emacs, LSP.services/- nix-gc and restic backups.
- Nix with flakes enabled (
nix-command,flakes). git.- SSH access to the private flake inputs:
git@git.sr.ht:~schemar/fontsgit@github.com:astutecat/moneymoney-to-ynab-rs
- macOS only: a previous nix-darwin setup so
darwin-rebuildis available. - Optional but used by the
justrecipes:nh,just,direnv,watchexec.
Clone the repo:
git clone git@github.com:astutecat/dotfiles.git
cd dotfilesEnter the dev shell. .envrc runs use flake; with direnv installed:
direnv allowOtherwise:
nix developThe dev shell provides just, direnv, prek, and the pre-commit hooks. Hooks are generated at .pre-commit-config.yaml on entry and run on pre-push (plus gitlint on commit-msg).
The justfile wraps nh. Apply everything for the current machine:
just applyOr apply the pieces individually:
# Linux
just nix-apply
# macOS (home + system)
just nix-apply
just nix-darwin-applyThe underlying commands are:
# Linux home environment
nh home switch . -c $(whoami)@$(hostname -s) --accept-flake-config
# macOS system (nix-darwin)
nh darwin switch .Watch for changes and re-apply on save:
just watchjust nix-updateThis runs nix flake update and refreshes fetchgit pins in all .nix files.
nix flake check --all-systemsThis is also run by the nix-flake-check pre-push hook. The formatter is nixfmt:
nix fmt