···11+# markdownlint configuration
22+# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
33+44+# MD013: Line length
55+# Tables and code blocks are exempt — long lines there are unavoidable.
66+# Prose limit raised to 120 to allow natural sentence flow.
77+MD013:
88+ line_length: 120
99+ tables: false
1010+ code_blocks: false
1111+1212+# MD033: Inline HTML — allowed for badges and image floats in README
1313+MD033: false
+25-37
CLAUDE.md
···16161717### Single Source of Truth
18181919-All configurable values — username, timezone, theme, packages, feature flags — are declared with typed defaults in **`modules/options.nix`**. Everything else reads from there.
1919+All configurable values — username, timezone, theme, packages, feature flags — are declared
2020+with typed defaults in **`modules/options.nix`**. Everything else reads from there.
20212122- System modules: `config.myConfig.*`
2223- Home-manager modules: `osConfig.myConfig.*`
···40414142### No Custom Abstraction
42434343-The old `cfgLib` helper was removed. Use the plain NixOS module system. See `lib/USAGE.md` for patterns including package resolution and authorized SSH keys.
4444-4545-## Directory Layout
4646-4747-```
4848-flake.nix # Defines all hosts; entry point
4949-modules/
5050- options.nix # ⭐ All option declarations and defaults
5151- common.nix # Shared NixOS settings (GC, auto-upgrade)
5252- desktop.nix # KDE Plasma 6 + SDDM
5353- gaming.nix # Steam + Gamemode
5454- packages.nix # Desktop system packages
5555- services.nix # Printing, Bluetooth, etc.
5656- users.nix # User accounts
5757- server/ # Headless server sub-modules
5858- darwin/ # macOS-specific modules
5959-hosts/
6060- laptop/ # Host-specific overrides
6161- server/
6262- macmini/
6363-home/
6464- default.nix # Home-manager entry point
6565- programs/ # Per-program configs: git, zsh, ssh, vscode, kde, starship…
6666-settings/
6767- darwin/ # macOS system.defaults (Dock, Finder, trackpad)
6868- plasma/ # KDE Plasma declarative settings
6969-profiles/ # Reusable config profiles (server-base, server-hardened)
7070-secrets/ # sops-encrypted secrets (age)
7171-tools/ # Rust maintenance utilities (health-check, flake-bump, gen-diff)
7272-lib/USAGE.md # Module patterns reference
7373-docs/ # Extended documentation
7474-```
4444+The old `cfgLib` helper was removed. Use the plain NixOS module system.
4545+See `lib/USAGE.md` for patterns including package resolution and authorized SSH keys.
75467647## Building
7748···1047510576Run `health-check` before rebuilding to catch common issues early (daemon, lock file, git cleanliness, age key, disk space).
106777878+## Infrastructure Diagrams (nix-topology)
7979+8080+SVG diagrams are auto-generated from NixOS configs. Physical connections and networks are defined in `topology.nix`.
8181+8282+```bash
8383+nix build .#topology.x86_64-linux.config.output
8484+# SVGs in ./result/
8585+```
8686+8787+When adding a new host, add its interfaces and physical connections to `topology.nix`.
8888+Service/interface data is extracted automatically from the NixOS module.
8989+10790## Secrets
1089110992Uses [sops-nix](https://github.com/Mic92/sops-nix) with age encryption.
···129112| home-manager | release-25.11 |
130113| nix-darwin | nix-darwin-25.11 |
131114| sops-nix | latest |
115115+| nix-topology | latest |
132116| plasma-manager | latest |
133117| catppuccin | latest |
134118| nix-vscode-extensions | latest |
···138122139123## Running Tools
140124141141-Unless a tool is explicitly listed as a shell alias or known to be installed, always use `nix run` rather than assuming it's on `$PATH`:
125125+Unless a tool is explicitly listed as a shell alias or known to be installed,
126126+always use `nix run` rather than assuming it's on `$PATH`:
142127143128```bash
144129nix run nixpkgs#<package> -- <args>
···152137nix run nixpkgs#nixfmt-rfc-style -- file.nix
153138```
154139155155-The maintenance tools (`health-check`, `flake-bump`, `gen-diff`) are the exception — they have shell aliases and are available after a rebuild.
140140+The maintenance tools (`health-check`, `flake-bump`, `gen-diff`) are the exception —
141141+they have shell aliases and are available after a rebuild.
156142157143## Code Style
158144159145- Formatter: `nixfmt-rfc-style` (run `nix fmt`)
160146- Follow existing patterns in the file you're editing
161161-- Keep options in `modules/options.nix` grouped by domain with `# ── Domain ──` headers
147147+- Keep options in `modules/options.nix` grouped by domain with
148148+ `# ── Domain ──` headers
162149- Prefer `lib.mkIf` over `if/then/else` blocks at the top level
163150164151## Common Tasks
···1731601741611. Create `hosts/<hostname>/default.nix`
1751622. Add hardware config (NixOS: `nixos-generate-config`)
176176-3. Add entry in `flake.nix` under `nixosConfigurations` or `darwinConfigurations`
163163+3. Add entry in `flake.nix` under `nixosConfigurations` or
164164+ `darwinConfigurations`
1771654. See `docs/hosts.md` for the full guide
178166179167**Add a new home-manager program:**
+62-111
README.md
···11# Nix Configuration
2233-v0.4.0
33+v0.5.0
4455Personal NixOS and nix-darwin configurations for managing multiple
66machines with a unified, centralized setup.
···16161717## Key Features
18181919-✨ **Centralized Configuration** - All option defaults in
2020- `modules/options.nix` (single source of truth)
2121-🔄 **DRY Principles** - Zero duplication; the NixOS module system handles everything
2222-🎯 **Easy Customization** - Change any default in one file, applies everywhere
2323-📦 **Multi-System** - Unified config for NixOS and macOS
2424-🏠 **Unified Home Manager** - Same shell, git, SSH config across all systems
2525-🔐 **Secrets Management** - Encrypted secrets with sops-nix
2626-🛠️ **Rust Tools** - `health-check`, `flake-bump`, `gen-diff` maintenance utilities
1919+✨ **Centralized Configuration** — All option defaults in `modules/options.nix` (single source of truth)
2020+🔄 **DRY Principles** — Zero duplication; the NixOS module system handles everything
2121+🎯 **Easy Customization** — Change any default in one file, applies everywhere
2222+📦 **Multi-System** — Unified config for NixOS and macOS
2323+🏠 **Unified Home Manager** — Same shell, git, SSH config across all systems
2424+🔐 **Secrets Management** — Encrypted secrets with sops-nix
2525+🗺️ **Infrastructure Diagrams** — Auto-generated topology SVGs via nix-topology
2626+🛠️ **Rust Tools** — `health-check`, `flake-bump`, `gen-diff` maintenance utilities
27272828## Managed Systems
29293030-### macOS (nix-darwin) - PRIMARY
3131-3232-- **macmini** - Apple Silicon Mac Mini (M2, 16 GB) — Main daily driver
3030+### macOS (nix-darwin) — PRIMARY
33313434-### Linux (NixOS) - SECONDARY
3232+- **macmini** — Apple Silicon Mac Mini (M2, 16 GB) — Main daily driver
35333636-- **laptop** - Dell Inspiron 3501 with KDE Plasma 6 — Secondary workstation
3737-- **server** - Minimal headless server — Bluesky PDS, Forgejo,
3838- Nextcloud, Cloudflare tunnel + hardened security
3434+### Linux (NixOS) — SECONDARY
39354040-## Repository Structure
4141-4242-```text
4343-.
4444-├── flake.nix # Main flake — defines all hosts
4545-├── flake.lock # Locked dependency versions
4646-│
4747-├── hosts/ # Host-specific configurations
4848-│ ├── laptop/ # Dell Inspiron 3501 (NixOS + KDE Plasma 6)
4949-│ ├── server/ # Headless server (NixOS)
5050-│ └── macmini/ # Mac Mini M2 (nix-darwin)
5151-│
5252-├── modules/ # Reusable system modules
5353-│ ├── options.nix # ⭐ All option declarations + defaults
5454-│ ├── common.nix # Base NixOS settings (gc, auto-upgrade, etc.)
5555-│ ├── desktop.nix # KDE Plasma 6 + SDDM
5656-│ ├── gaming.nix # Steam + Gamemode
5757-│ ├── packages.nix # Desktop system packages
5858-│ ├── services.nix # Printing, Bluetooth, etc.
5959-│ ├── users.nix # User account configuration
6060-│ ├── caddy.nix # Caddy web server
6161-│ ├── pds.nix # Bluesky ATProto PDS
6262-│ ├── pds-landing/ # PDS landing page assets
6363-│ ├── forgejo.nix # Forgejo git forge
6464-│ ├── nextcloud.nix # Nextcloud instance
6565-│ ├── cloudflare-tunnel.nix # Cloudflare tunnel (outbound-only)
6666-│ ├── ssh-keys.nix # Public key registry for all hosts
6767-│ ├── server/ # Headless server sub-modules
6868-│ │ ├── firewall.nix
6969-│ │ ├── intrusion.nix # fail2ban
7070-│ │ ├── ssh.nix # sshd hardening
7171-│ │ ├── hardware-health.nix
7272-│ │ ├── maintenance.nix
7373-│ │ ├── packages.nix
7474-│ │ ├── services.nix
7575-│ │ └── disable-noise.nix
7676-│ └── darwin/ # macOS-specific modules
7777-│ ├── common.nix
7878-│ ├── homebrew.nix
7979-│ ├── packages.nix
8080-│ └── system.nix
8181-│
8282-├── profiles/ # Reusable configuration profiles
8383-│ ├── server-base.nix # Base server config
8484-│ └── server-hardened.nix # Security hardening
8585-│
8686-├── home/ # Home Manager (unified across all hosts)
8787-│ ├── default.nix # Main entry point
8888-│ ├── scripts/ # User scripts (update-all, verify-ssh-external, ...)
8989-│ └── programs/ # git, zsh, ssh, vscode, kde, ghostty, ...
9090-│
9191-├── settings/ # Platform-specific declarative settings
9292-│ ├── darwin/ # macOS system.defaults (Dock, Finder, trackpad, etc.)
9393-│ └── plasma/ # KDE Plasma declarative settings
9494-│
9595-├── secrets/ # sops-encrypted secrets (safe to commit)
9696-│ ├── setup.sh # Key management helper
9797-│ └── *.env / *.json / ... # Encrypted secret files
9898-│
9999-├── hooks/
100100-│ └── pre-commit # auto-format: nix, sh, rust, toml, md
101101-│
102102-├── tools/ # Rust maintenance tools
103103-│ └── src/bin/ # health-check, flake-bump, gen-diff, server-config
104104-└── wallpapers/
105105-```
3636+- **laptop** — Dell Inspiron 3501 with KDE Plasma 6 — Secondary workstation
3737+- **server** — Minimal headless server — Bluesky PDS, Forgejo, Nextcloud,
3838+ Immich, Jellyfin, Cloudflare tunnel + hardened security
1063910740## Configuration Architecture
10841···170103sudo darwin-rebuild switch --flake .#macmini
171104```
172105106106+## Infrastructure Diagrams
107107+108108+Uses [nix-topology](https://github.com/oddlama/nix-topology) to automatically
109109+generate SVG diagrams of the infrastructure from the NixOS configurations.
110110+Physical connections and networks that can't be inferred automatically are
111111+defined in `topology.nix`.
112112+113113+**Render the diagrams:**
114114+115115+```bash
116116+nix build .#topology.x86_64-linux.config.output
117117+# SVGs are in ./result/
118118+```
119119+120120+This produces two diagrams:
121121+122122+- `main.svg` — physical host/interface layout
123123+- `network.svg` — network-centric view showing which hosts share which networks
124124+125125+**Updating topology:**
126126+127127+Edit `topology.nix` to reflect physical changes (new cables, new networks, etc.).
128128+Service and interface information is extracted automatically from the NixOS configs.
129129+173130## Customization
174131175132**All defaults live in `modules/options.nix`** — one option block per domain.
176133177134```bash
178135# Examples of what to edit
179179-nano modules/options.nix # Username, timezone, packages, themes, etc.
180180-nano hosts/laptop/default.nix # Enable gaming, desktop mode, etc.
181181-nano hosts/server/default.nix # Enable server services
182182-nano settings/darwin/default.nix # macOS Dock, Finder, trackpad
183183-nano settings/plasma/default.nix # KDE Plasma layout and behaviour
136136+nano modules/options.nix # Username, timezone, packages, themes, etc.
137137+nano hosts/laptop/default.nix # Enable gaming, desktop mode, etc.
138138+nano hosts/server/default.nix # Enable server services
139139+nano topology.nix # Physical network connections
140140+nano settings/darwin/default.nix # macOS Dock, Finder, trackpad
141141+nano settings/plasma/default.nix # KDE Plasma layout and behaviour
184142```
185143186144See [`docs/settings.md`](docs/settings.md) for the full guide and
···192150### Health Check (Recommended Before Building)
193151194152```bash
195195-# Compile the tools (one-time)
196196-nix run .#tools -- --help
197197-198198-# Run health check
199199-tools/target/release/health-check
200200-201201-# Or use the shell alias
202153health-check
203154```
204155···206157207158```bash
208159nix flake update
209209-# Then rebuild
210210-sudo nixos-rebuild switch --flake .#laptop
211211-# or
212212-nix run .#tools -- flake-bump
160160+# or selectively
161161+flake-bump
213162```
214163215164### Garbage Collection
216165217166```bash
218218-# Runs automatically weekly on NixOS (configured in modules/common.nix)
219219-sudo nix-collect-garbage -d
220220-221221-# Or use the alias
167167+# Runs automatically weekly (configured in modules/common.nix)
222168cleanup
223169```
224170···2401861. Create `hosts/YOUR-HOSTNAME/default.nix`
2411872. Generate hardware config: `nixos-generate-config --show-hardware-config`
2421883. Add entry to `flake.nix` → `nixosConfigurations`
243243-4. Build: `sudo nixos-rebuild switch --flake .#YOUR-HOSTNAME`
189189+4. Add the host's interfaces/connections to `topology.nix`
190190+5. Build: `sudo nixos-rebuild switch --flake .#YOUR-HOSTNAME`
244191245192## Inputs
246193···250197| [home-manager][home-manager] | release-25.11 |
251198| [nix-darwin][nix-darwin] | nix-darwin-25.11 |
252199| [sops-nix][sops-nix] | latest |
200200+| [nix-topology][nix-topology] | latest |
253201| [plasma-manager][plasma-manager] | latest |
202202+| [catppuccin][catppuccin] | latest |
203203+| [nix-vscode-extensions][nix-vscode-extensions] | latest |
204204+| [mac-app-util][mac-app-util] | latest |
254205255206[nixpkgs]: https://github.com/NixOS/nixpkgs
256207[home-manager]: https://github.com/nix-community/home-manager
257208[nix-darwin]: https://github.com/LnL7/nix-darwin
258209[sops-nix]: https://github.com/Mic92/sops-nix
210210+[nix-topology]: https://github.com/oddlama/nix-topology
259211[plasma-manager]: https://github.com/nix-community/plasma-manager
212212+[catppuccin]: https://github.com/catppuccin/nix
213213+[nix-vscode-extensions]: https://github.com/nix-community/nix-vscode-extensions
214214+[mac-app-util]: https://github.com/hraban/mac-app-util
260215261216## Unified Configuration Benefits
262217···288243### Host Management
289244290245- [`docs/hosts.md`](docs/hosts.md) — hosts documentation index
291291-- [`docs/hosts-overview.md`](docs/hosts-overview.md) — complete
292292- comparison of all three hosts
293293-- [`docs/hosts-modification.md`](docs/hosts-modification.md) —
294294- how to modify and add hosts
295295-- [`docs/hosts-laptop.md`](docs/hosts-laptop.md) — Dell Inspiron
296296- 3501 (NixOS + KDE Plasma 6)
246246+- [`docs/hosts-overview.md`](docs/hosts-overview.md) — complete comparison of all three hosts
247247+- [`docs/hosts-modification.md`](docs/hosts-modification.md) — how to modify and add hosts
248248+- [`docs/hosts-laptop.md`](docs/hosts-laptop.md) — Dell Inspiron 3501 (NixOS + KDE Plasma 6)
297249- [`docs/hosts-server.md`](docs/hosts-server.md) — headless server setup
298250- [`docs/hosts-macmini.md`](docs/hosts-macmini.md) — macOS with nix-darwin
299251- [`docs/TAILSCALE-SSH.md`](docs/TAILSCALE-SSH.md) — inter-host SSH over Tailscale
···301253### Settings Management
302254303255- [`docs/settings.md`](docs/settings.md) — settings overview
304304-- [`docs/settings-structure.md`](docs/settings-structure.md) —
305305- why the config is modular
256256+- [`docs/settings-structure.md`](docs/settings-structure.md) — why the config is modular
306257- [`docs/secrets.md`](docs/secrets.md) — secrets management