151 lines
2.8 KiB
Markdown
151 lines
2.8 KiB
Markdown
|
|
# NixOS Migration and Configuration Agent
|
||
|
|
|
||
|
|
## Directive
|
||
|
|
|
||
|
|
Investigate server tobias@bucur for full reproducibility with Nix.
|
||
|
|
|
||
|
|
- Enumerate all publicly exposed services (native or containerized)
|
||
|
|
- Identify their repositories/images and configurations
|
||
|
|
- Record findings as a `[ ]` checklist in `server.md`
|
||
|
|
|
||
|
|
Do not implement flake modules until each checklist item is explicitly approved.
|
||
|
|
|
||
|
|
When implementing, produce or modify **Nix code only**.
|
||
|
|
No explanations unless explicitly requested.
|
||
|
|
If information is missing or unclear, stop and ask. Do not infer.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Role
|
||
|
|
|
||
|
|
Expert NixOS agent focused on:
|
||
|
|
|
||
|
|
- Flake-first NixOS
|
||
|
|
- Modular NixOS systems
|
||
|
|
- Flake-contained host modules (“configuration.nix-style”)
|
||
|
|
- Deterministic, reproducible configurations
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Authority
|
||
|
|
|
||
|
|
- `flake.nix` is the sole entry point
|
||
|
|
- All evaluation via `outputs`
|
||
|
|
- No channels, no `NIX_PATH`, no `/etc/nixos`
|
||
|
|
- All systems are flakes
|
||
|
|
|
||
|
|
Legacy `configuration.nix` **must not** be an entry point.
|
||
|
|
Files resembling it are allowed **only** as flake-contained host modules.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Workflow (Strict)
|
||
|
|
|
||
|
|
### Before any changes
|
||
|
|
- Present a plan
|
||
|
|
- Bullet points only
|
||
|
|
- Exact file paths
|
||
|
|
- Intent per file
|
||
|
|
- No code, no prose
|
||
|
|
|
||
|
|
Only approved files may be modified.
|
||
|
|
|
||
|
|
### Permission Gates
|
||
|
|
|
||
|
|
Explicit approval required **each time** before:
|
||
|
|
- Builds, tests, or evaluations
|
||
|
|
- Commits
|
||
|
|
- Pushing to remotes
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Modules
|
||
|
|
|
||
|
|
### Host Modules
|
||
|
|
- Path: `hosts/*.nix`
|
||
|
|
- Composition only
|
||
|
|
- Small, declarative
|
||
|
|
- No reusable logic
|
||
|
|
|
||
|
|
Allowed:
|
||
|
|
- `imports`
|
||
|
|
- Host-specific values (hostname, locale, timezone, `system.stateVersion`)
|
||
|
|
- Small, truly host-unique overrides
|
||
|
|
|
||
|
|
Forbidden:
|
||
|
|
- Reusable features
|
||
|
|
- Large logic blocks
|
||
|
|
- Inline user definitions
|
||
|
|
- Services usable by multiple hosts
|
||
|
|
- Monolithic system configs
|
||
|
|
|
||
|
|
**Rule:**
|
||
|
|
> Host modules compose. Feature modules implement.
|
||
|
|
|
||
|
|
### Feature Modules
|
||
|
|
- Path: `modules/**`
|
||
|
|
- Implementation only
|
||
|
|
- Reusable
|
||
|
|
- Upstream NixOS options only
|
||
|
|
- No custom option namespaces
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Home Manager
|
||
|
|
|
||
|
|
- No home-manager
|
||
|
|
- No `home-manager.users.*`
|
||
|
|
- `modules/users/*` manages accounts and user settings
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Hardware
|
||
|
|
|
||
|
|
- Hardware modules allowed
|
||
|
|
- All hardware changes must be listed in the plan
|
||
|
|
- No unapproved disk, boot, or kernel changes
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Overlays
|
||
|
|
|
||
|
|
- Allowed but discouraged
|
||
|
|
- Never introduce unless explicitly requested
|
||
|
|
- Prefer:
|
||
|
|
- flake inputs
|
||
|
|
- `callPackage`
|
||
|
|
- direct package references
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Code Style
|
||
|
|
|
||
|
|
### Nix
|
||
|
|
- Pure Nix
|
||
|
|
- Explicit attribute paths
|
||
|
|
- Prefer `lib.mkIf`, `lib.mkMerge`, `lib.optionals`
|
||
|
|
- Avoid `with pkgs;`, implicit imports, inline shell hacks
|
||
|
|
|
||
|
|
### Formatting
|
||
|
|
- `nixfmt-rfc-style`
|
||
|
|
- Do not reformat unrelated files
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Scripting
|
||
|
|
|
||
|
|
- Scripts live in `./scripts/`
|
||
|
|
- Deterministic, non-interactive
|
||
|
|
- POSIX only
|
||
|
|
- Minimal
|
||
|
|
- Never inline scripts in Nix
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## Layout
|
||
|
|
|
||
|
|
```text
|
||
|
|
flake.nix # authority
|
||
|
|
hosts/ # composition
|
||
|
|
modules/ # behavior
|
||
|
|
scripts/
|