Files
nixfiles/home/claude/memory/git_commit_signing.md
T
Emma Thorpe 10cc6cceed refactor(flake): add user registry and multi-user host support
Separate user identity (data) from the reusable modules, and let a host
declare any number of users instead of exactly one.

- users/registry.nix: per-user identity (name, email, groups, authorized
  and signing keys) as the single source of identity; no user data is
  hardcoded in the modules.
- mkHost takes a `users` set keyed by username; per-user identity is
  injected into each home config via the `identity` module arg
  (extraSpecialArgs is per-host, so it cannot carry per-user data).
- modules/users.nix builds accounts from the registry; modules/ssh.nix no
  longer defines authorized keys (the registry owns them); home/git.nix
  and home/desktop.nix read `identity`; users/emmathorpe/work.nix drops
  its now-redundant git identity override.
- Restructure the tree: users/, home/, modules/, hosts/, lib/ replace the
  former lyrathorpe/ and system/ layout.
- Add standalone homeConfigurations (the portable subset: shell, git,
  editor, claude) and an exported homeModules output for use on machines
  not managed by this flake, or as an input to other flakes.

Behaviour-preserving for existing hosts: lyrathorpe-mbp and
emmathorpe-edaas evaluate to identical derivations; lyrathorpe-t400,
lyrathorpe-macpro31 and lyrathorpe-rpi5 differ only by de-duplicating a
repeated authorized_keys entry. Fixes the SSH authorized-key leak (one
user's key was applied to every account), the hardcoded default git
identity, and the hardcoded EDaaS linger setting.
2026-06-29 12:27:52 +01:00

2.3 KiB

name, description, metadata
name description metadata
git-commit-signing Commits sign in-sandbox via ssh-agent — needs `allowAllUnixSockets: true` in settings, plus pubkey inlined in user.signingkey.
node_type type originSessionId
memory feedback a223254b-6bee-435f-ac39-e3cedf064893

Lyra's git is configured to SSH-sign commits (commit.gpgsign=true, gpg.format=ssh). The sandbox masks ~/.ssh/* (read-denied; the files appear as char devices backed by /dev/null), so git cannot read a file-based user.signingkey and ssh-keygen cannot read the private key directly. Signing in-sandbox therefore requires routing through ssh-agent over the agent's unix socket.

Working setup (as of 2026-06-02):

  1. NixOS / home-manager runs an ssh-agent so /run/user/1000/ssh-agent exists and SSH_AUTH_SOCK is exported into the sandbox env.
  2. ~/.claude/settings.json has sandbox.network.allowAllUnixSockets: true to let the sandbox connect() to that socket. On Linux/WSL2 this is the ONLY available switch — the per-path sandbox.network.allowUnixSockets array is macOS-only because the seccomp filter cannot inspect socket paths. Tradeoff: every unix socket on the host (including /var/run/docker.sock if present, DBus, etc.) becomes reachable from sandboxed commands.
  3. user.signingkey set to the inlined pubkey: git config --global user.signingkey "key::$(cat ~/.ssh/id_ed25519.pub)". Must run with DOUBLE quotes outside the sandbox so $(...) expands; single quotes or running it from inside the sandbox stores literal garbage (cat ~/.ssh/id_ed25519.pub reads /dev/null in-sandbox).

Why: removes the per-commit ! git commit ... friction; private key stays in the agent, never enters the sandbox.

How to apply: Commit normally with git commit. If signing fails with Couldn't load public key, check (a) git config --get user.signingkey starts with key::ssh-ed25519 AAAA... (not literal $(...)), (b) ssh-add -l from in-sandbox lists keys (if it says "Operation not permitted", the sandbox config didn't take effect — restart Claude Code), (c) the ssh-agent on the host actually has the key loaded (ssh-add -l outside the sandbox). Do NOT use --no-gpg-sign to bypass — the repo's ReleaseWorkflow-Commit check enforces signed commits.

Related: git-network-ops, git-conventions.