feat(skills): add nix style guidance
This commit was merged in pull request #54.
This commit is contained in:
17
src/skills/nix-style/RULE-FORMAT.md
Normal file
17
src/skills/nix-style/RULE-FORMAT.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Rule format
|
||||
|
||||
Use this structure for each rule:
|
||||
|
||||
```md
|
||||
## Rule title
|
||||
|
||||
### Rule
|
||||
|
||||
State enforceable instructions.
|
||||
|
||||
### Rationale
|
||||
|
||||
Explain why the rule exists.
|
||||
```
|
||||
|
||||
Add `### Examples` only when examples clarify the rule.
|
||||
37
src/skills/nix-style/SKILL.md
Normal file
37
src/skills/nix-style/SKILL.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: nix-style
|
||||
description: Use when creating, editing, or reviewing Nix files in this repository.
|
||||
---
|
||||
|
||||
# nix-style
|
||||
|
||||
Use this skill as the source of truth for repository Nix conventions.
|
||||
|
||||
## Load rules
|
||||
|
||||
Read every Markdown file under [`rules/`](rules/) before applying this skill.
|
||||
Discover rule files from the skill source:
|
||||
|
||||
```bash
|
||||
find src/skills/nix-style/rules -maxdepth 1 -type f -name '*.md' -print | sort
|
||||
```
|
||||
|
||||
Finish when all discovered rule files have been read.
|
||||
|
||||
## Apply rules
|
||||
|
||||
Apply the loaded rules when editing or reviewing Nix files.
|
||||
When loaded rules conflict, follow the most specific rule.
|
||||
|
||||
After editing Nix files, run:
|
||||
|
||||
```bash
|
||||
nix run .#fix
|
||||
```
|
||||
|
||||
Finish when the Nix change follows the loaded rules.
|
||||
|
||||
## Maintain rules
|
||||
|
||||
When adding or changing files under [`rules/`](rules/), read [`RULE-FORMAT.md`](RULE-FORMAT.md) first.
|
||||
Finish when the changed rule files follow that format.
|
||||
13
src/skills/nix-style/rules/flake.md
Normal file
13
src/skills/nix-style/rules/flake.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Flake rules
|
||||
|
||||
## Keep `flake.nix` as flake wiring
|
||||
|
||||
### Rule
|
||||
|
||||
Add flake inputs in `flake.nix`.
|
||||
Put new flake output implementation in `src/dotfiles/default.nix`.
|
||||
Use `flake.nix` to pass inputs into that implementation.
|
||||
|
||||
### Rationale
|
||||
|
||||
This keeps dependency declarations separate from output logic.
|
||||
Reference in New Issue
Block a user