Current state of main at 0240060 feat(hp-laptop): install TeleportFling from its flake. History intentionally collapsed to a single commit; this repo mirrors only the latest state.
5.6 KiB
5.6 KiB
AGENTS.md — Nix-Vibe AI Agent Instructions
A Nix Flakes-based multi-host NixOS + Home Manager configuration repository.
Quick Reference
- Build/Test:
nix flake check(mustgit addnew files first) - Task runner:
just(seejustfile) —justdeploys a host + restarts quickshell,just check,just dry-build,just test,just restart-qs - Format:
nixpkgs-fmt .(ornix fmt— the flake defines anixpkgs-fmtformatter) - Dev shell:
nix develop(providessops,age,nixpkgs-fmt) - Apply:
sudo nixos-rebuild switch --flake .#<hostname> - Test (no activation):
sudo nixos-rebuild test --flake .#<hostname> - Remote apply:
nixos-rebuild switch --target-host <host> --flake .#<hostname> --use-remote-sudo - Dry-build:
nixos-rebuild dry-build --flake .#<hostname>
Architecture
| Directory | Purpose |
|---|---|
hosts/<name>/ |
Per-machine configs (configuration.nix, disko-config.nix, hardware-configuration.nix) |
modules/core/ |
Shared NixOS modules (common, fonts, settings, sops, podman, dev, users, management, known-hosts) |
modules/desktop/ |
GUI desktop modules and app-specific modules |
modules/hardware/ |
Hardware-specific modules (fingerprint, nvidia) |
modules/services/ |
Service modules (immich, jellyfin, ntfy, paperless, immich-proxy) |
modules/storage/ |
Disk configuration via Disko |
home-manager/modules/ |
Shared Home Manager modules (zsh, gnome, firefox, kitty, etc.) |
home-manager/users/ |
Per-user Home Manager configs |
flake.nix |
Entry point — defines nixosConfigurations via mkNixosSystem helper |
Host overview and software inventory: see README.md.
Critical Rules
Style
- Language: Nix — follow conventions used in the
nixpkgsrepository. - Formatter:
nixpkgs-fmt .(run before every commit).
Git & Flakes
- NEW FILES MUST BE STAGED (
git add) beforenix flake checkornixos-rebuild. Flake evaluation only sees Git-tracked files. - Do NOT commit until
nix flake checkAND a dry-build pass.
Module Pattern
- New service modules follow the pattern:
lib.mkEnableOptionforenable+lib.mkIf config.services.<name>.enable { ... }. - Example: modules/services/immich.nix
Secrets
- Secrets are managed via SOPS + age in
secrets.yaml. - Reference in host configs as
sops.secrets."<path>" = { ... };. - Rendered config files (e.g. container env files) use
sops.templates— see docs/sops-secrets.md.
Sudo
- Passwordless sudo is granted to
petereonly viasecurity.sudo.extraRules(NOPASSWD) inmodules/core/common.nix. All other wheel users must enter a password forsudo.
Zsh
programs.zsh.enable = truemust be set in NixOS config for Zsh users.- Shared Zsh config uses
home-manager.sharedModulesinflake.nix— do NOT usehome.file.".zshrc".
Servers vs Desktops
- Servers (
richmond-server,homeserver-1,mcf-server) useserverOverlays(lightweight). - Desktops/laptops use
desktopOverlays(stablewithout CUDA) by default. - Only
x1carbonuses the fulloverlaysset with CUDA, NDI, stable packages (OBS Studio).
Deprecated Options
- Pay attention to warnings about deprecated options during
nix flake checkornixos-rebuild. Refer to NixOS/Home Manager release notes for updated options. Keeping configurations current prevents surprises on channel updates.
Homepage Dashboard (gethomepage.dev)
- Dashboard definition for homeserver-1 lives in
hosts/homeserver-1/homepage.nix(imported by the host config), NOT inconfiguration.nix. - Full guide for adding machines/tabs/services: docs/homepage-dashboard.md.
- Widget group names MUST be unique — the credentialed proxy resolves config by leaf group name; duplicate names cause one machine's stats to render on another's tiles.
- Every Glances widget tile needs a
metricfield (info,cpu,memory,fs:/,process, ...) andversion = 4; omittingmetricthrowst.metric is undefined. - Tailscale widget
deviceidmust be the numeric device ID (from the Tailscale API), not the...CNTRLvalue. - API keys are injected as
HOMEPAGE_VAR_*env vars from the SOPS secrethomeserver-1/homepage-env— never hardcode keys inhomepage.nix. - After editing
homepage.nix, if changes don't appear after rebuild, restart the service:sudo systemctl restart homepage-dashboard(config files are only read at service start). - Homepage is exposed on Tailscale only (port 8082).
Post-Modification Workflow
- Update
README.mdsoftware inventory and host overview if relevant - When adding a new host, add it to the Host Reference table in
.github/skills/nix-flake-rebuild/SKILL.md(informational; the dry-build loop is dynamic) git addall modified/new filesnix flake checknixos-rebuild dry-build --flake .#<hostname>for affected hosts- Commit only after both checks pass
Documentation
- README.md — Full architecture, host roles, and entry point for all docs
- docs/software-inventory.md — Cross-reference matrix of software per host
- docs/installation.md — nixos-anywhere deployment guide
- docs/sops-secrets.md — SOPS/age secrets management
- docs/borg-backup-setup.md — BorgBackup server setup (deprecated - migrated to Backrest)
- docs/homepage-dashboard.md — Homepage dashboard: adding machines, tabs & services