Commit Graph

178 Commits

Author SHA1 Message Date
e49fb929d8 feat(fish): rebuild the flake for the running host
`nixos-rebuild switch` alone leaves the flake implicit, which is not how
this system is built. Name it explicitly, taking the host from the
configuration that installs the shell so the two cannot disagree.

The reference stays relative, so `update` rebuilds the working tree the
shell is standing in rather than a fixed checkout.
2026-07-20 14:04:51 -04:00
78081143cf refactor: flatten the single-file lib and system directories
Each held one default.nix, so the directory added a level to descend without
grouping anything. They are now lib.nix and system.nix beside flake.nix, which
reads as the flake's own scaffolding.

The shared base config's reference to the shared secrets file was relative to
the directory it sat in, so it moves with the file.

Verified to build the same system toplevel as before the move.
2026-07-20 13:05:07 -04:00
6b5729b98a refactor(ssh): state the admitted keys directly instead of deriving them
The access policy was a separate fleet declaration mapping each machine to a
role and a client key, which the module looked up by hostname to derive what to
authorize. Authorizing a key needs the key text and nothing else, so the
per-machine names, the hostname lookup and the role existed only to reconstruct
a grouping that two lists already are.

The module now exposes those two lists and the set a machine admits, and a host
declares what it draws from in its own file. The fleet declaration is gone, and
with it a single-file directory at the repository root.

`authorizedKeys` defaults to the workstation keys. An option of a list type is
not mandatory the way a scalar one is: undeclared, it yields the empty list
rather than failing, and a machine admitting no key is unreachable. The default
makes the safe case the silent one.

Verified to produce the same system as the design it replaces, and against the
running machine in both directions.
2026-07-20 13:05:07 -04:00
f18b40091c feat(ssh): adopt the client key as a secret and derive access from roles (task 0019)
The operator's SSH client key existed only as a file created by hand on one
laptop, so a reimage would destroy it and lock the operator out of the remote.
It now lives in neogaia's own secrets file, encrypted to the admin identity and
neogaia alone, and the client is pointed at the decrypted path rather than a
copy in the user's home.

Access becomes a policy over roles instead of a per-host list of keys. A new
fleet declaration names each machine's role and client public key, and every
machine derives what it authorizes from that: a workstation admits workstations
alone, a server admits both, so a compromised server reaches no machine of the
operator's own. Registering a machine is an entry in that one file.

Only neogaia exists, so the server half of the policy is built rather than
exercised. Two assertions reject a machine missing from the fleet and any entry
whose role no policy defines.
2026-07-20 13:05:07 -04:00
4ecb86052b docs(git): record the verified deployment (task 0015)
Also note that `git config --global` lists only ~/.gitconfig and is not a
view of what git resolves, which misreads as the module's file being
ignored.
2026-07-20 12:22:36 -04:00
62eb6286b4 feat(git): enable the module per host rather than by default
Defaulting the module on hid it from a host's config, leaving no single
place that lists what a host carries. Each host enables it explicitly
instead, at the cost of a step when adding one.
2026-07-20 12:20:13 -04:00
75c5745cbd feat(git): carry the commit identity on every host
Default the module on rather than restating it per host, so a new host
commits without remembering the line. A host that should not carry a
personal identity sets enable to false.
2026-07-20 11:15:15 -04:00
c9fc17ecf5 feat(git): declare the operator's commit identity (task 0015)
Git identity lived only in one checkout's local configuration on one
machine, so it was invisible to every other checkout and lost on a
reimage. Declare it as a module instead, enabled on neogaia.

It is a module rather than base plumbing so a host that should not carry
a personal commit identity can decline it.
2026-07-20 10:53:47 -04:00
0d685ce277 docs: close out task 0014 after confirming the timers 2026-07-20 10:27:40 -04:00
c63c3079be feat(nix): bound the store, generations and boot menu (task 0014)
Garbage collection and store optimisation each run weekly, on separate
days so they never contend, and retained boot configurations are capped
at 15.
2026-07-20 10:21:24 -04:00
dcc03155a2 docs(install): revise for sops-provisioned identities (task 0012)
The procedure was built around a login password set by hand through
nixos-enter, a step that no longer exists now that the password arrives
as a decrypted secret. Rather than patch around it, revise the document:
the LUKS passphrase is named as the only hand-entered secret, and identity
provisioning moves ahead of first boot, since there is no fallback
credential to get in with if decryption fails.

Cover the three procedures the install alone did not: provisioning a
running host live, the editing workflow and what it needs the admin
identity for, and recovery from the live ISO.
2026-07-20 10:04:12 -04:00
11d7cb053c docs(tasks): add task 0019, user SSH keys and an access policy
Per-machine client identities, so a compromised machine surrenders only
its own key, plus a role-based rule for which machines may reach which.
Only neogaia exists, so the server half is recorded rather than exercised.
2026-07-20 09:51:34 -04:00
ec40892560 refactor(ssh): flatten the module to a single file
Every module folder here carries companion files alongside its .nix. This
one has none, so the folder added a level for nothing.
2026-07-20 09:29:13 -04:00
a6ada9dac3 chore(neogaia): comment the host public keys as the machine, not root
The trailing field is free text stamped in by ssh-keygen from the account
that ran it. Naming the machine says what the key identifies.
2026-07-20 07:57:40 -04:00
42ff195556 refactor(ssh): extract the host key wiring into a module
The sops secret declarations, the empty `hostKeys`, and the `HostKey`
lines were boilerplate sitting in the host, and every future host
restoring its identity would have repeated them.

`modules.ssh` takes the encrypted file and the key types, deriving the
secret names and the `HostKey` lines from one list, so the daemon and the
secrets cannot disagree about where a key lives. The resulting system
derivation is unchanged.

Also record two gotchas: reading PR review comments needs the Gitea API
rather than tea, and host keys are not user authentication keys.
2026-07-20 07:40:47 -04:00
60738f65c2 docs: correct the forge CLI gotcha, a tea login does exist 2026-07-19 23:54:08 -04:00
61ce9cc1be feat(neogaia): restore the SSH host keys from sops (task 0011)
The host's SSH identity was generated by the daemon, so reimaging the
laptop would invalidate it and break `known_hosts` for every client that
had ever connected.

Add `secrets/neogaia.yaml`, the first per-host secrets file, encrypted to
the admin identity and `neogaia` alone so a compromised machine cannot
decrypt another's material. It holds both host private keys; the public
halves are committed in plaintext.

Clear `services.openssh.hostKeys` to stop generation and point `HostKey`
at the decrypted paths. These are ordinary secrets rather than the
pre-user ones the password uses, exercising the second decryption path.
2026-07-19 23:53:01 -04:00
ce103a7353 feat(secrets): decrypt the login password from sops (task 0010)
Wire sops-nix into the shared base config as unconditional plumbing, with
a two-tier age identity model: an admin identity held outside the repo, and
a per-host identity generated on the machine and kept on its encrypted root.
Both `sshKeyPaths` defaults are cleared so the SSH host keys stay out of the
decryption path and remain free to become secrets in their own right.

The primary user's password hash moves into a shared secrets file encrypted
to admin plus neogaia, consumed through `hashedPasswordFile` and decrypted
before accounts are created.

This needs `users.mutableUsers = false`: NixOS applies a declared hash to an
already-existing account only when that flag is false, so at the default the
hand-set password would have been kept and the change would have been inert.
Root consequently has no password and is locked; sudo from wheel is the way
in, and generation rollback remains the recovery path.
2026-07-19 23:43:28 -04:00
7711b841dd docs(neogaia): record the boot verification for task 0017 2026-07-19 23:12:14 -04:00
66582b498c fix(neogaia): replace guessed hardware detection with a real scan (task 0017)
The detection file was written before the machine ran NixOS, as an educated
guess at what a Dell XPS 13 9380 needs, and said so. Its contents now come
from nixos-generate-config on the running machine.

The guess was wider than the measurement rather than narrower: it named
thunderbolt, usb_storage and sd_mod, none of which the scan reports, and
omitted rtsx_pci_sdmmc. Nothing needed to reach the root device was missing.

Filesystem, swap, LUKS and microcode declarations from the scan are dropped.
The disk layout derives the first three and the hardware profile supplies the
last, so carrying them here would duplicate definitions that are produced on
every evaluation.
2026-07-19 22:28:02 -04:00
54c191f801 feat(claude-code): share sudo's credential cache across sessions (task 0018)
Key sudo's credential cache per user rather than per terminal, holding it
for 60 minutes. An authentication made in the operator's own terminal then
covers commands issued by processes holding no terminal of their own, which
previously failed with a bare non-zero exit and no output.

No command is made passwordless. The password remains required; only the
cache holding it is shared, and any process running as the primary user can
spend that credential until it lapses.

A PreToolUse hook refuses a privileged command while the cache is cold,
naming the command that warms it, so the condition announces itself rather
than presenting as a stall. Both states were exercised against the running
system.
2026-07-19 22:18:58 -04:00
d0bfc7b21b docs: correct the gitea-axi gotcha and record home.file's absolute keys 2026-07-19 19:08:54 -04:00
e5d8f69f16 feat(claude-code): ask questions in prose, never via AskUserQuestion 2026-07-19 19:04:48 -04:00
42c602b814 docs: close out task 0016 after reimaging neogaia
The reimage is done and verified on hardware: the boot partition is 2 GiB
and reports it, the hardware profile's kernel parameter and module blacklist
are live, and the encrypted root unlocks to a console login.

The install procedure ran without divergence, which is the reproducibility
evidence the task was after.

The reimage also wiped the hand-written git identity, so the gotcha
describing it is updated to record the failure it now provokes.
2026-07-19 18:53:17 -04:00
431f75aad7 feat(neogaia): declare a 2 GiB EFI system partition (task 0016)
Each generation stores a kernel and an initrd on the EFI system partition,
and this host runs a large third-party kernel, so 512 MiB holds only about
seven. An exhausted partition fails at bootloader installation, after the
build has already succeeded.

The partition cannot grow in place: it sits first on the disk with the
encrypted container immediately behind it, and an encrypted volume's start
offset cannot move without rewriting its whole payload. Only an install
applies this layout, so the change takes effect at the next reimage and
does nothing to the running machine until then.

Record that a flake only sees git-tracked files, which cost an evaluation
earlier, and correct the git identity gotcha that a hand-written gitconfig
had made false.
2026-07-19 17:14:18 -04:00
488bb15683 docs: correct two stale claims in the install procedure
The parenthetical enumerating the public flake inputs named three of the
eight now present, so it is stated as a rule rather than a list that drifts
each time an input is added.

The bootstrap-ordering note also said the install consumes the flake from
Gitea, contradicting the later explanation that disko-install reads a local
clone and fetches nothing of ours. Both describe the same requirement, so
the first now states it as the clone it is.
2026-07-19 17:07:37 -04:00
13e5a9bb56 docs: describe the current secrets design in the install procedure
The closing section still described key derivation from each machine's SSH
host key, a mechanism that was superseded because it forces new host keys
on every reimage and makes storing those keys as secrets circular.

Record the two-tier identity model that replaced it, and warn that the
hand-set bootstrap password stops working once the password becomes a
secret: hashedPasswordFile outranks every other password option, so a
machine installed after that must have its identity provisioned before
first boot rather than a password set afterwards.
2026-07-19 16:56:36 -04:00
5b3ebdccf3 docs: correct the repository name in the install procedure
The clone step named a repository that does not exist, so following the
procedure verbatim failed before reaching the install. The remote is
alexion/dotfiles.
2026-07-19 16:55:10 -04:00
8c85c02a7d docs: close out task 0013 after confirming it on hardware
The rebooted laptop selects deep sleep, runs thermal and power management,
and no longer loads the PS/2 mouse driver. Booted, running and freshly
built toplevels are the same store path, so the readings come from this
configuration rather than a surviving generation.
2026-07-19 16:51:03 -04:00
f94aaba6c1 docs: correct the gotcha claiming the Gitea CLI is installed
No gitea-axi, tea or gh exists on the NixOS build, and there is no tea
login or GITEA_* environment to authenticate with. The flake names
gitea-axi only in the claude-code module's permissions and never packages
it, so pull requests cannot be opened from this machine.

The previous wording described the laptop while it still ran CachyOS with
these tools installed by hand.
2026-07-19 16:41:39 -04:00
25049c8aef feat(neogaia): adopt the upstream hardware profile (task 0013)
The laptop's hardware facts were guessed before it ran NixOS. Hand them to
the upstream nixos-hardware profile for this exact model, which fixes four
things that are wrong on the running machine: the laptop suspends into
s2idle rather than deep S3, the PS/2 mouse driver loads over an i2c
touchpad, no thermal management runs, and firmware updates are impossible.

The profile is taken wholesale, including the Intel graphics support it
carries. Those packages are inert without a display server, and trimming
them would mean diverging from upstream for no present benefit.

Drop the host's own Intel microcode setting, which the profile now defaults
from the redistributable firmware already enabled here.

The input follows the base nixpkgs: only its NixOS modules are consumed, so
its own pin would be evaluated by nothing while drifting silently.

The two acceptance criteria needing a reboot are left open; the sleep mode
and module blacklist only take effect on a fresh boot.
2026-07-19 16:41:34 -04:00
4c0d36324c docs: unblock the reimage from the non-boot-affecting tasks
Only the hardware profile needs to precede the reimage, because it is the
one change that touches boot: a kernel parameter and a module blacklist.
Validating it while a known-good generation still exists means the reimage
installs a configuration already proven on this hardware, where a freshly
imaged machine has no rollback target.

The housekeeping and commit-identity changes carry no boot risk and apply
equally well after the wipe, so they no longer gate it. The case for
reimaging soon rests on the machine holding almost nothing, and that
weakens with every day of use.
2026-07-19 16:20:21 -04:00
f80ea948ea docs: plan the post-boot hygiene tasks
neogaia was installed from a configuration written before the hardware
existed, so several things are now knowably wrong rather than guessed.

Adopt the upstream hardware profile for this laptop, which fixes deep
sleep, thermal management and the touchpad driver. Bound the store, the
retained generations and the boot menu, none of which have a limit today.
Declare the commit identity, which currently lives only in one checkout.

Grow the EFI system partition, which holds around seven generations at
its present size and cannot be enlarged in place, since the encrypted
container immediately behind it would have to be relocated. That makes a
reimage the only practical route, and the cheapest moment for one is now.
It doubles as the reproducibility test of the install documentation.
2026-07-19 16:11:52 -04:00
5e254857b9 docs: plan sops secrets with two-tier age identities
Supersede ADR 0001's SSH-derived key mechanism with an admin identity held
outside the repo plus a per-host identity on each encrypted root. Decoupling
the two is what lets the SSH host keys become secrets themselves rather than
the root of trust they were.

Add the spec, the three implementing tasks, and the glossary terms the
breakdown speaks in.
2026-07-19 14:57:41 -04:00
7cd9370366 docs: refresh the gotchas for a self-hosting dev machine
The dev host no longer runs CachyOS, so the per-command experimental-features
export and the from-source CachyOS kernel build no longer apply. Records the
missing git identity in their place.
2026-07-19 11:44:08 -04:00
066bf467ba feat: remap caps lock to escape on every host
Sets the xkb layout and `caps:escape_shifted_capslock` in the shared base
config, and builds the console keymap from it so the remap applies on a
bare TTY rather than only under a graphical session. Shift+Caps Lock
still toggles Caps Lock.

neogaia's `console.keyMap` is dropped: `console.useXkbConfig` defines
that option itself, so the two definitions would conflict.
2026-07-19 11:43:41 -04:00
7809e079e3 docs(claude-code): teach the skill-management skills the Nix layout
~/.claude/skills is generated by home-manager: the directories are real
but every leaf file is a read-only symlink into the store. The skills
that author and install skills assumed it was an ordinary writable tree.

- craft-skill: personal skills are authored in modules/claude-code/skills
  and applied by a rebuild, never edited under ~/.claude/skills; writing
  there succeeds silently and strands the skill outside the repo.
- setup-skills, update-skills: copy out of the library with cp -rL and
  chmod -R u+w. A plain cp -r copies the symlinks, committing store paths
  into the project, and dereferenced files keep the store's read-only mode.
- craft-skill also staged through `dot add`, a fish function this repo no
  longer carries; plain git add replaces it.
2026-07-19 08:34:22 -04:00
bdb6f01934 docs: standardise on gitea-axi as the Gitea CLI
The Gotchas entry named `tea` as the CLI for issue and pull-request work.
`gitea-axi` supersedes it; `tea` stays installed only to hold the `axi`
login that `gitea-axi` authenticates from.
2026-07-19 08:28:34 -04:00
064971f601 docs: adopt Conventional Commits for commit messages
Vendor the v1.0.0 specification as docs/conventional-commits.md and record
the convention in CLAUDE.md: type and optional scope, where the scope names
the module or host, and no Gitea-specific references, since this repository
is mirrored to GitHub where issue and pull-request numbers resolve to
unrelated things.
2026-07-19 08:24:54 -04:00
41709bb977 chore!: remove the pre-NixOS dotfiles tree
The flake and its modules now own every config these files provided;
they remain in history for reference while the migration finishes.

BREAKING CHANGE: `.config/`, `.gitconfig`, and `.github/` no longer exist
at the repository root. A checkout that deploys this tree into `$HOME`
will delete the live configs it previously installed.
2026-07-19 08:01:49 -04:00
77e853ab49 docs: rewrite the in-file comment convention
Encode the sharpened ruleset: why-over-what, self-containment, the
absence-only cross-file exception, no domain-glossary terms, no
against-alternative or future-state framing, one-line file headers,
placeholder wording, and how option description strings differ.
2026-07-19 07:57:44 -04:00
6a10f760cf refactor(lib): remove the unused scriptFromFile helper
It had no callers; the built system's derivation is unchanged by its
removal.
2026-07-19 07:57:44 -04:00
91d0a7d8e4 style: trim verbose comments to concise, self-contained notes
Cut restated "what", domain-glossary framing, cross-file consumption
narration, and against-alternative justification from in-file comments;
keep only non-obvious "why" and load-bearing pointers. Drop the
`generateCompletions` line (a no-op restatement of the upstream default)
and its comment.
2026-07-19 07:57:44 -04:00
7810425849 docs(neogaia): document the one-shot install flow
Add docs/install.md, the operator runbook that turns the completed
neogaia Host into a running encrypted laptop from the NixOS live ISO:
push the flake to its remote, join wifi, clone the repo locally,
disko-install against neogaia with the chaotic substituter handed to the
install-time daemon, set the bootstrap login password by hand via
nixos-enter, and reboot.
2026-07-19 07:57:43 -04:00
b7363ed7e1 feat(claude-code): manage the user's global config in the Module
Bring the declarative half of ~/.claude into modules/claude-code and apply
it when the Module is enabled: the global agent instructions (context =
./CLAUDE.md), the skills tree (skills = ./skills), the attention-bell hook,
and settings.json (model = opus plus the Stop/Notification/SessionStart
hook wiring).

Runtime state (projects, plugins, cache, history, sessions) and the
.credentials.json secret are left out, so login survives rebuilds and no
secret enters the repo. Verified against the built home-files that
~/.claude/{CLAUDE.md,settings.json,skills,hooks/attention-bell.sh} are
generated, the hook executable.
2026-07-19 07:57:43 -04:00
505002bb2b feat(claude-code): add a Module and enable it on neogaia
Install Claude Code through home-manager's native programs.claude-code
module, matching how the tmux and fish Modules use their home-manager
options rather than a raw home.packages entry. The feature Module at
modules/claude-code/claude-code.nix stays thin — just the enable option
and the delegation — and writes no settings, so login and first-run
configuration remain interactive and no auth material enters the repo.

Signing in without a browser (needed over the console or SSH) is
documented in modules/claude-code/authentication.md: the paste-code OAuth
flow, where the printed URL is opened on another device and the code
pasted back, and the ANTHROPIC_API_KEY path for non-interactive use.

The neogaia toplevel builds with claude-code-2.1.209 included.
2026-07-19 07:57:43 -04:00
6f9309d329 feat(nvim): configure Neovim via nixvim with Nix-managed plugins
Add an nvim Module that configures Neovim declaratively through nixvim,
wired as a flake input and consumed as its home-manager module. Options,
globals, keymaps, and plugin settings are typed Nix; the colorscheme
call and two autocmds live in modules/nvim/config.lua via extraConfigLua.
Plugins come from nixpkgs (no plugin manager, no runtime cloning); git,
ripgrep, and fd are provided from Nix; treesitter grammars are built by
Nix so no runtime compiler is needed.

Functionally matches the previous config (plugins, keymaps, options, the
nord colorscheme, markdown conceal, the Neogit blame toggle), verified
headless against the generated init.
2026-07-19 07:57:43 -04:00
98fecc314f chore: untrack the reference/ snapshot and gitignore it
reference/ is a read-only snapshot of the pre-migration machine, kept
locally for porting configs but not part of the flake. Stop tracking it
and ignore it so migrations don't churn the repo.
2026-07-19 07:57:43 -04:00
80d1587189 feat(tmux): add a native Module and enable it on neogaia
Configure tmux through home-manager's programs.tmux: the settings it exposes
as options (prefix, keyMode, mouse, baseIndex, clock24, escapeTime,
historyLimit, terminal) are set as options, and every setting it has no option
for is read verbatim from modules/tmux/extra.conf. No tmux plugin manager is
used. The generated config is behaviourally identical to the reference, verified
by parsing it with a live tmux binary.
2026-07-19 07:57:21 -04:00
7e53ecd946 style(fish): split the plugin comment and drop a redundant one 2026-07-19 07:57:21 -04:00