This repository has no description
3.3 kB
94 lines
1# CLAUDE.md
2
3This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
5## Repository Overview
6
7This is lassulus's personal NixOS/nix-darwin configuration repository, built on clan-core for managing multiple machines. It includes:
8- Multiple machine configurations in `machines/`
9- Configuration modules in `configs/` and `modules/`
10- Custom packages in `pkgs/`
11- packages which could in theory be upstreamed to nixkgs should go into the pkgs folder, in the tools folder we add tools we write ourself which are more complex or not upstreamable
12
13## Key Architecture Components
14
15### Machine Management
16- **Clan-core**: Primary framework for managing multiple machines
17- **Secrets**: Uses password-store for secrets management via clan.core.vars
18
19### Network Overlays
20The repository manages multiple overlay networks:
21- **Tor**: Anonymous network access
22
23### Module System
24- `configs/`: Main configuration modules
25- `configs/default.nix`: imported by all machines
26- `modules/`: Custom NixOS module definitions
27- Stockholm modules are also imported for krebs infrastructure
28
29## Common Development Commands
30
31```bash
32# Enter development shell
33nix develop
34
35# Deploy to a specific machine
36clan machines update <MACHINE_NAME>
37
38# Format code
39nix fmt
40
41# Build NixOS configuration
42nix build .#nixosConfigurations.<machine-name>.config.system.build.toplevel
43
44# Build Darwin configuration
45nix build .#darwinConfigurations.barnacle.system
46
47# Deploy/rebuild Darwin configuration (for barnacle)
48sudo darwin-rebuild switch --flake .#barnacle
49
50# Access machines via SSH
51ssh <machine-name>.r # via retiolum
52ssh <machine-name>.s # via spora
53ssh <machine-name>.n # via nether
54torify ssh $(pass show machines/<machine-name>/tor-hostname) # via tor
55```
56
57## Important: Git Staging for Flake Evaluation
58
59**CRITICAL**: New nix files must be staged (git add) before they are available in flake evaluation. When creating new packages, modules, or any nix files, always run `git add <files>` before testing with `nix build`, `nix run`, etc.
60
61## Git Push Policy
62
63**CRITICAL**: NEVER `git push` to any remote. Local commits are fine when asked.
64A push happens only when the user runs it themselves or explicitly says
65"push" for that specific change in the current conversation. This includes
66all remotes (origin, HTTPS via gh credentials, pair) and all branches.
67
68## Machine Facts and Secrets via vars
69
70- SSH public keys
71- Network identities (retiolum, mycelium, zerotier)
72- Syncthing IDs
73- DKIM keys (for mail servers)
74
75Secrets are managed via password-store and uploaded to `/run/secrets` on deployment.
76
77## Adding New Machines
78
791. Create directory `machines/<name>/`
802. Add `config.nix`, `physical.nix`, and optionally `disk.nix`
813. Generate facts using clan-cli
824. Add to inventory in `flake.nix`
835. Deploy using `clan machines update <name>`
84
85## Pre-Commit
86
87**CRITICAL**: Always run `nix fmt` before committing to ensure all files pass the treefmt formatting check in CI.
88
89## Commit Message Guidelines
90
91- Use simple, descriptive commit messages without attribution footers
92- Use flake attribute paths as prefixes (e.g., `tools.mutt:` not just `mutt:`)
93- For flake.lock updates, use: "flake.lock: update"
94- Follow existing patterns seen in git log