···11+# CLAUDE.md
22+33+This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
44+55+## Repository Overview
66+77+This is lassulus's personal NixOS/nix-darwin configuration repository, built on clan-core for managing multiple machines. It includes:
88+- Multiple machine configurations in `machines/`
99+- Configuration modules in `2configs/` and `3modules/`
1010+- Custom packages in `5pkgs/`
1111+- Various network overlays (retiolum, spora, nether, zerotier, mycelium)
1212+1313+## Key Architecture Components
1414+1515+### Machine Management
1616+- **Clan-core**: Primary framework for managing multiple machines
1717+- **Inventory**: Machines are tagged in `flake.nix` (laptop/server tags)
1818+- **Secrets**: Uses password-store for secrets management via clan.core.facts
1919+- **Deployment**: Uses krops (via stockholm) for deployment
2020+2121+### Network Overlays
2222+The repository manages multiple overlay networks:
2323+- **Retiolum**: VPN network (access via `.r` suffix)
2424+- **Spora**: Mycelium-based P2P network (access via `.s` suffix)
2525+- **Nether**: ZeroTier-based network overlay (access via `.n` suffix)
2626+- **Tor**: Anonymous network access
2727+2828+### Module System
2929+- `2configs/`: Main configuration modules (imported by all machines)
3030+- `3modules/`: Custom NixOS module definitions
3131+- Stockholm modules are also imported for krebs infrastructure
3232+3333+## Common Development Commands
3434+3535+```bash
3636+# Enter development shell
3737+nix develop
3838+3939+# Run interactive menu (default package)
4040+nix run
4141+4242+# Deploy to a specific machine
4343+nix run .#deploy -- <MACHINE_NAME>
4444+4545+# Format code
4646+nix fmt
4747+4848+# Build NixOS configuration
4949+nix build .#nixosConfigurations.<machine-name>.config.system.build.toplevel
5050+5151+# Build Darwin configuration
5252+nix build .#darwinConfigurations.barnacle.system
5353+5454+# Access machines via SSH
5555+ssh <machine-name>.r # via retiolum
5656+ssh <machine-name>.s # via spora
5757+ssh <machine-name>.n # via nether
5858+torify ssh $(pass show machines/<machine-name>/tor-hostname) # via tor
5959+```
6060+6161+## Machine Facts and Secrets
6262+6363+Each machine stores its public facts in `machines/<name>/facts/` including:
6464+- SSH public keys
6565+- Network identities (retiolum, mycelium, zerotier)
6666+- Syncthing IDs
6767+- DKIM keys (for mail servers)
6868+6969+Secrets are managed via password-store and uploaded to `/etc/secrets` on deployment.
7070+7171+## Adding New Machines
7272+7373+1. Create directory `machines/<name>/`
7474+2. Add `config.nix`, `physical.nix`, and optionally `disk.nix`
7575+3. Generate facts using clan-cli
7676+4. Add to inventory in `flake.nix`
7777+5. Deploy using `nix run .#deploy -- <name>`
7878+7979+## Testing
8080+8181+- VM tests: `./5pkgs/init/test.sh`
8282+- Container tests are configured in `2configs/container-tests.nix`