| name | nixos-configurations |
|---|---|
| description | Use for NixOS configuration work in /persist/nix-config: flakes, dendritic layout, package sets, scripts outside .nix, Go/go run instead of Python, host/container/service patterns, and gated verification. |
Use this skill for NixOS host, container, LXC, Home Manager, module, overlay, package-set, service, build, deploy, and Nix documentation work in this repository.
- Use flakes only. Treat
flake.nixas the source of truth for configurations and package sets. - Prefer dendritic configuration: small directories,
default.nixentrypoints, narrow modules, and local manifests or fleet metadata when they already fit. - New configurations must use dendritic style. For existing configurations, prefer dendritic extensions, but do not reshape or reorganize them unless the operator explicitly asks.
- Inspect live files before adding services, users, secrets, queues, bridges, containers, sidecars, agents, or workflows. Extend the existing model minimally.
- Split scripts out of
.nixfiles. Colocate scripts with the module that owns them and wire them withbuiltins.readFile,writeShellScript,writeShellApplication, or a package. - Do not use Python. When Python would normally be expected, use Go or
go run; prefergo runwhen it avoids package or compile ceremony. - Use 2-space Nix indentation, trailing semicolons, logical attr ordering, no unused bindings, and kebab-case filenames.
- Shared NixOS logic lives under
modules/features/*. - Reusable system shapes live under
modules/roles/*. - Keep
hosts/<host>/default.nixthin: roles, hardware, storage, networking, and host-local services. - Home Manager composes
home-manager/features/*; prefer explicit host feature flags over hostname branching. - Keep LXC configs in
lxc/, with one system per config. New LXC systems must be defined inflake.nix, importmodules/roles/lxc-base.nix, mount this repo read-only at/etc/nixos, use a dedicated/config, and avoid interactive behavior. - For
cloud, preserve the manifest style inhosts/cloud/services/manifest.nix,hosts/cloud/services/default.nix, andhosts/cloud/containers/fleet.nix. - For containers, prefer existing common modules such as
common.nix,common-podman.nix, andcontainer-sops.nixwhere they apply.
- Do not change the
buildPackageSetcontract inflake.nix; it definesstable,unstable, anddefault. - Modules receive
pkgs,spkgs, andupkgs; preferpkgsunless the version source matters. - Register overlays through
overlays/default.nix; keep overlays pure and shaped asfinal: prev:. - Use
nivfor pinned non-flake sources inoverlays/nix/sources.jsonandoverlays/nix/sources.nix. Update pins withniv, and consume evaluated sources through the flake or narrow arguments rather than repeated fetchers. - Keep Neovim plugins in
overlays/nvim-overlays.nixwithvimUtils.buildVimPluginandnivsources.
- Stateless services should follow
docs/adr/ADR-001-General-Ephemeral-Service-Pattern.md. - Prefer
RuntimeDirectoryor strictly managed paths for state. - Use
LoadCredentialfor service secrets. - Use
ExecStartPostwhen service state must be restored on every start. - Do not add
sops-nix.serviceas anafter,requires, orwantsdependency in units or modules. - Use
sops-nixandrbwfor secrets. Beforerbw, runrbw unlocked; if it is not OK, stop and report thatrbwis locked. - Keep durable service state reconstructable from committed configuration, encrypted secrets, and documented operator inputs.
The verification gate in AGENTS.md controls whether these may be run.
- Host deploy:
sudo nixos-rebuild switch --flake .#<hostname>. - LXC/container build:
nix build .#nixosConfigurations.<container-name>.config.system.build.toplevel. - ISO build:
nix build .#iso_x86. - OpenWrt:
./images/openwrt-vm/update-ow-feeds.sh, thennix build .#packages.x86_64-linux.ow-vm-image. cloudrebuild source:cd /persist/nix-config/nx-ago-testing && sudo nixos-rebuild switch --flake .#cloud.- In
hosts/cloud/,just updateandjust deploywrap that same rebuild. Usejust secretsfor secret management. - Do not use
/persist/deploy/nix-config, target-local prepared checkouts, or deploy markers as a normalcloudrebuild source.
For NixOS, Home Manager, package, and Nix language documentation search, call the NixOS reference MCP directly:
mcp-cli call nixos-reference nix \
'{"action":"search","query":"systemd.services","type":"options","limit":20}'
mcp-cli call nixos-reference nix \
'{"action":"search","query":"programs.zellij","source":"home-manager","limit":20}'
mcp-cli call nixos-reference nix \
'{"action":"search","query":"tutorials/nix-language","source":"nix-dev","limit":20}'