Imported from shayne/nixos-config (
AGENTS.md). Install upstream withnpx skills add shayne/nixos-config. Copyright stays with the author.
Repository Guidelines
Agent Skill Usage
- Do not use
using-superpowersor other Superpowers skills for work in this repository unless the user explicitly asks for that specific skill or workflow.
Project Structure & Module Organization
flake.nix/flake.lock: flake entrypoint and pinned inputs.systems/: host configs. Common defaults live insystems/base/; per-host overrides live insystems/<hostname>/(e.g.,systems/m5mbp/).home-manager/: user profiles (global defaults inhome-manager/<user>/default.nix, per-host overrides inhome-manager/<user>/<hostname>/).- Do not remove seemingly empty
home-manager/<user>/<hostname>/default.nixfiles without checkinglib/mkSystem.nix; those tracked host directories determine which users attach to which hosts. modules/: reusable Nix modules (shells, editors, services).overlays/+pkgs/: custom packages and overlay wiring.flake.nix/flake.lock: source pinning and flake outputs.nixpkgs.nix: compatibility helper for importing the flake-pinned nixpkgs.iso/: ISO build scripts.
Darwin / Homebrew Conventions
- Darwin hosts use
systems/<hostname>/darwin-configuration.nix; shared Darwin defaults live insystems/base/darwin-configuration.nix. - Manage Homebrew declaratively through nix-darwin/nix-homebrew, not with imperative
brew install. - Use
homebrew.brewsfor CLI formulae,homebrew.casksfor GUI apps,homebrew.masAppsfor Mac App Store apps, andhomebrew.tapsfor extra tap repos needed by tap-qualified packages. - Prefer host-scoped edits for host-specific Darwin packages unless the user explicitly asks for a shared/base change.
- When the user asks to upgrade Homebrew packages, formulae, or casks, update only the pinned Homebrew tap inputs in
flake.lockwithnix flake update homebrew-core homebrew-cask, then apply the Darwin config withmise runon the target host. Do not run barenix flake updatefor this request, and do not run imperativebrew updateorbrew upgrade;homebrew.onActivation.upgrade = truemakes nix-darwin's generatedbrew bundleupgrade declared formulae/casks from the flake-pinned taps during activation. - For small Darwin package changes, prefer targeted verification with
nix eval --json .#darwinConfigurations.<host>.config.homebrew.brewsornix eval --json .#darwinConfigurations.<host>.config.homebrew.casksbefore runningmise runon the target host.
Build, Test, and Development Commands
mise run(ormise run default): builds and switches the system for the current host (Darwin usesdarwin-rebuild switch).mise run lint: runsdeadnix,nixpkgs-fmt, andstatix(same checks as the pre-commit hook).mise run check: runsmise run lint, thennix flake check --all-systems, and builds the current host system for validation.
Coding Style & Naming Conventions
- Nix files use 2‑space indentation and compact attribute sets.
- Host names map directly to folder names (e.g.,
systems/m5mbp,home-manager/shayne/m5mbp). - Prefer
pkgs.stdenv.hostPlatform.systemover deprecatedpkgs.systemorsystemalias. - Formatting: use
nix fmt(flake formatter is configured via nix-formatter-pack).
Testing Guidelines
- No standalone test suite; rely on
mise run checkfor evaluation/build sanity. - Validate host changes by running
mise runon the target host. - When deciding whether a Home Manager module is actually used, verify all three layers: the import site, the host/user attachment in
lib/mkSystem.nix, and the built closure or generated config output. A successful system build alone can miss accidentally detaching a user from a host. - Stage newly added host marker files before trusting flake evaluation results. Untracked files may not be visible to the Git-based flake source that
nixevaluates.
Commit & Pull Request Guidelines
- Commit messages follow a short “scope: summary” style (examples:
systems/m5mbp: enable nix-index program,flake: update all dependencies). - Use
Revert "..."when rolling back a change. - PRs should include: a short summary, affected hosts, and the exact command(s) run (e.g.,
mise run check,mise run). - When a change affects active hosts, secret bootstrap/decryption, or common operator commands, update
README.mdin the same change so the repo docs stay current.
Security & Configuration Tips
- Treat secrets/shayne.yaml and secrets/custom-fonts.tar.gz as sensitive. Edit them with
sops; do not reintroduce legacygit-cryptor*.enc.nixworkflows. - The repo decrypts secrets with
~/.ssh/id_ed25519viaSOPS_AGE_SSH_PRIVATE_KEY_FILE. Do not switch back tokeys.txtor implicit key discovery unless the user explicitly asks for it.