docs(skills): add nix let review rule

This commit is contained in:
2026-09-16 13:44:35 -04:00
parent 8154feba5a
commit 652b92d4f4
4 changed files with 117 additions and 125 deletions

View File

@@ -13,9 +13,19 @@ Do not report preferences unless a loaded rule states them.
Use this format for each finding: Use this format for each finding:
```text ```text
`path:line`: Finding title. `code-path:line`
> `smallest reviewed-code excerpt that shows the violation`
`rule-file:line`: Finding title.
Summary: why the code breaks the rule Summary: why the code breaks the rule
Fix: suggested fix Fix: suggested fix
``` ```
Keep the code excerpt to one to three lines when possible.
Use a longer excerpt only when the violation needs surrounding context.
Use `...` to omit unrelated lines from a multi-line excerpt.
Use a skill-relative rule citation, such as `let.md:7`.
Make the fix direct.
Do not include alternatives when one fix best follows the cited rule.
It is acceptable to report no findings when the reviewed Nix already follows the loaded rules. It is acceptable to report no findings when the reviewed Nix already follows the loaded rules.

View File

@@ -103,120 +103,89 @@
- centralize shared system group names, starting with the `storage` group - centralize shared system group names, starting with the `storage` group
## nix refactor ## nix refactor
```text
nixos Review Nix files in entrypoint order:
├── guests
│ ├── actualbudget.nix - [x] `flake.nix`
│ ├── copyparty.nix - [ ] `src/dotfiles/default.nix`
│ ├── reverse-proxy.nix - [ ] `src/dotfiles/util.nix`
│ └── valheim.nix - [ ] `src/dotfiles/formatter.nix`
├── hosts - [ ] `src/dotfiles/apps.nix`
│ ├── neogaia - [ ] `src/dotfiles/registry.nix`
│ │ ├── default.nix - [ ] `configs/nixos/registry/address.nix`
│ │ ├── disk.nix - [ ] `configs/nixos/registry/env-var.nix`
│ │ ├── hardware-configuration.nix - [ ] `configs/nixos/registry/homepage.nix`
│ │ ├── ssh_host_ed25519_key.pub - [ ] `configs/nixos/registry/route.nix`
│ │ └── ssh_host_rsa_key.pub - [ ] `configs/nixos/registry/shell-shortcut.nix`
│ ├── pikachu - [ ] `configs/nixos/registry/stable-uid.nix`
│ │ ├── default.nix - [ ] `src/dotfiles/modules.nix`
│ │ ├── disk.nix - [ ] `configs/nixos/modules/default.nix`
│ │ ├── hardware-configuration.nix - [ ] `configs/nixos/modules/host.nix`
│ │ ├── ssh_host_ed25519_key.pub - [ ] `configs/nixos/modules/guest.nix`
│ │ └── ssh_host_rsa_key.pub - [ ] `configs/nixos/modules/monorepo.nix`
│ └── zeus - [ ] `configs/nixos/modules/zfs.nix`
│ ├── default.nix - [ ] `configs/nixos/modules/network/ssh.nix`
│ ├── disk.nix - [ ] `configs/nixos/modules/network/vlans.nix`
│ ├── hardware-configuration.nix - [ ] `configs/nixos/modules/network/vpn-client.nix`
│ ├── ssh_host_ed25519_key.pub - [ ] `configs/nixos/modules/desktop/default.nix`
│ └── ssh_host_rsa_key.pub - [ ] `configs/nixos/modules/desktop/apps/alacritty.nix`
├── modules - [ ] `configs/nixos/modules/desktop/apps/firefox.nix`
│ ├── desktop - [ ] `configs/nixos/modules/desktop/apps/ghostty.nix`
│ │ ├── apps - [ ] `configs/nixos/modules/desktop/apps/obsidian.nix`
│ │ │ ├── alacritty.nix - [ ] `configs/nixos/modules/desktop/apps/signal.nix`
│ │ │ ├── firefox.nix - [ ] `configs/nixos/modules/desktop/apps/steam.nix`
│ │ │ ├── ghostty.nix - [ ] `configs/nixos/modules/desktop/apps/vencord.nix`
│ │ │ ├── obsidian.nix - [ ] `configs/nixos/modules/desktop/session/hyprland/default.nix`
│ │ │ ├── signal.nix - [ ] `configs/nixos/modules/desktop/session/hyprland/hypridle.nix`
│ │ │ ├── steam.nix - [ ] `configs/nixos/modules/desktop/session/hyprland/hyprlock.nix`
│ │ │ └── vencord.nix - [ ] `configs/nixos/modules/desktop/session/login.nix`
│ │ ├── session - [ ] `configs/nixos/modules/desktop/session/mako.nix`
│ │ │ ├── hyprland - [ ] `configs/nixos/modules/desktop/session/portals.nix`
│ │ │ │ ├── default.nix - [ ] `configs/nixos/modules/desktop/session/rofi.nix`
│ │ │ │ ├── hypridle.nix - [ ] `configs/nixos/modules/desktop/session/waybar.nix`
│ │ │ │ └── hyprlock.nix - [ ] `configs/nixos/modules/desktop/utilities/audio.nix`
│ │ │ ├── login.nix - [ ] `configs/nixos/modules/desktop/utilities/clipboard.nix`
│ │ │ ├── mako.nix - [ ] `configs/nixos/modules/desktop/utilities/osd.nix`
│ │ │ ├── portals.nix - [ ] `configs/nixos/modules/desktop/utilities/recording.nix`
│ │ │ ├── rofi.nix - [ ] `configs/nixos/modules/desktop/utilities/screenshot.nix`
│ │ │ └── waybar.nix - [ ] `configs/nixos/modules/desktop/utilities/theming.nix`
│ │ ├── utilities - [ ] `configs/nixos/modules/desktop/utilities/userdirs.nix`
│ │ │ ├── audio.nix - [ ] `configs/nixos/modules/services/actualbudget.nix`
│ │ │ ├── clipboard.nix - [ ] `configs/nixos/modules/services/copyparty.nix`
│ │ │ ├── osd.nix - [ ] `configs/nixos/modules/services/homepage.nix`
│ │ │ ├── recording.nix - [ ] `configs/nixos/modules/services/navidrome.nix`
│ │ │ ├── screenshot.nix - [ ] `configs/nixos/modules/services/reverse-proxy.nix`
│ │ │ ├── theming.nix - [ ] `configs/nixos/modules/services/steamcmd.nix`
│ │ │ └── userdirs.nix - [ ] `configs/nixos/modules/services/games/palworld.nix`
│ │ └── default.nix - [ ] `configs/nixos/modules/services/games/valheim.nix`
│ ├── network - [ ] `configs/nixos/modules/shell/bazel.nix`
│ │ ├── ssh.nix - [ ] `configs/nixos/modules/shell/direnv/default.nix`
│ │ ├── vlans.nix - [ ] `configs/nixos/modules/shell/fish/default.nix`
│ │ └── vpn-client.nix - [ ] `configs/nixos/modules/shell/gitea-axi.nix`
│ ├── services - [ ] `configs/nixos/modules/shell/git.nix`
│ │ ├── games - [ ] `configs/nixos/modules/shell/herdr.nix`
│ │ │ └── valheim.nix - [ ] `configs/nixos/modules/shell/nvim/default.nix`
│ │ ├── actualbudget.nix - [ ] `configs/nixos/modules/shell/omp.nix`
│ │ ├── copyparty.nix - [ ] `configs/nixos/modules/shell/pi/default.nix`
│ │ ├── reverse-proxy.nix - [ ] `configs/nixos/modules/shell/python.nix`
│ │ └── steamcmd.nix - [ ] `configs/nixos/modules/shell/rust.nix`
│ ├── shell - [ ] `configs/nixos/modules/shell/tmux/default.nix`
│ │ ├── direnv - [ ] `configs/nixos/modules/shell/yazi.nix`
│ │ │ ├── default.nix - [ ] `src/dotfiles/guests.nix`
│ │ │ └── repo-flake.sh - [ ] `configs/nixos/guests/actualbudget.nix`
│ │ ├── fish - [ ] `configs/nixos/guests/copyparty.nix`
│ │ │ ├── completions - [ ] `configs/nixos/guests/homepage.nix`
│ │ │ │ └── bazel.fish - [ ] `configs/nixos/guests/navidrome.nix`
│ │ │ ├── functions - [ ] `configs/nixos/guests/palworld.nix`
│ │ │ │ ├── copy.fish - [ ] `configs/nixos/guests/reverse-proxy.nix`
│ │ │ │ └── deploy-to.fish - [ ] `configs/nixos/guests/valheim.nix`
│ │ │ ├── config.fish - [ ] `src/dotfiles/hosts.nix`
│ │ │ └── default.nix - [ ] `configs/nixos/hosts/neogaia/default.nix`
│ │ ├── nvim - [ ] `configs/nixos/hosts/neogaia/disk.nix`
│ │ │ ├── config.lua - [ ] `configs/nixos/hosts/neogaia/hardware-configuration.nix`
│ │ │ └── default.nix - [ ] `configs/nixos/hosts/pikachu/default.nix`
│ │ ├── pi - [ ] `configs/nixos/hosts/pikachu/disk.nix`
│ │ │ ├── patches - [ ] `configs/nixos/hosts/pikachu/hardware-configuration.nix`
│ │ │ │ ├── pi-flex-spacer.patch - [ ] `configs/nixos/hosts/zeus/default.nix`
│ │ │ │ ├── pi-project-resource-ancestors.patch - [ ] `configs/nixos/hosts/zeus/disk.nix`
│ │ │ │ └── pi-tool-lookup-validation.patch - [ ] `configs/nixos/hosts/zeus/hardware-configuration.nix`
│ │ │ └── default.nix
│ │ ├── tmux
│ │ │ ├── default.nix
│ │ │ └── extra.conf
│ │ ├── bazel.nix
│ │ ├── git.nix
│ │ ├── gitea-axi.nix
│ │ ├── herdr.nix
│ │ ├── python.nix
│ │ ├── rust.nix
│ │ └── yazi.nix
│ ├── default.nix
│ ├── guest.nix
│ ├── host.nix
│ ├── monorepo.nix
│ └── zfs.nix
├── registry
│ ├── address.nix
│ ├── env-var.nix
│ ├── route.nix
│ ├── shell-shortcut.nix
│ └── stable-uid.nix
├── secrets
│ ├── neogaia.yaml
│ ├── pikachu.yaml
│ ├── shared.yaml
│ └── zeus.yaml
├── .sops.yaml
├── AGENTS.md
└── README.md
```

View File

@@ -9,12 +9,8 @@ Use this skill as the source of truth for repository Nix conventions.
## Load rules ## Load rules
Read every Markdown file under [`rules/`](rules/) before applying this skill. Read every Markdown file directly under [`rules/`](rules/) before applying this skill.
Discover rule files from the skill source: Resolve [`rules/`](rules/) relative to this `SKILL.md`.
```bash
find src/skills/nix-style/rules -maxdepth 1 -type f -name '*.md' -print | sort
```
Finish when all discovered rule files have been read. Finish when all discovered rule files have been read.
@@ -29,7 +25,8 @@ After editing Nix files, run:
nix run .#fix nix run .#fix
``` ```
Finish when the Nix change follows the loaded rules. Finish when `nix run .#fix` succeeds and the Nix change follows the loaded rules.
If the command fails, report the failure.
## Maintain rules ## Maintain rules

View File

@@ -0,0 +1,16 @@
# Let rules
## Prefer explicit dependencies over shared convenience bindings
### Rule
Do not add a `let` binding only to let sibling values share one expression.
When one sibling value owns the concept, reference that sibling value directly.
When a flake output owns the public value, reference that output through `self`.
Do not make an output attrset recursive only to reference sibling outputs.
### Rationale
Shared convenience bindings hide dependency direction.
Explicit references show which value owns a concept and which value consumes it.