# sops configuration for ~/NixDaemon (sops-nix). Two kinds of secret, two keys,# so the user's key no longer opens what only root should read:## secrets/system/* host + admin. Decrypted by the system at activation with the# host key /var/lib/sops-nix/key.txt (root 0600, age-keygen on# this machine; modules/hosts/laptop/sops.nix).# secrets/* the user's key ~/.config/sops/age/keys.txt (where the sops CLI# looks; modules/home/sops.nix). It cannot open secrets/system/.## The first rule that matches wins, so secrets/system/ must stay above secrets/.## TMPDIR=/dev/shm sops secrets/<file> edit a user secret# sudo env SOPS_AGE_KEY_FILE=/var/lib/sops-nix/key.txt TMPDIR=/dev/shm \# sops secrets/system/<file> edit a system secret# sops updatekeys <file> after changing the keys below# (sudo + host key for system files)## Recovery: all three private keys (user, host, admin) are in one passphrase-# encrypted bundle on an offline USB, never on this disk:# mkdir -m 700 /dev/shm/keys; age -d nixdaemon-age-keys.tar.age | tar -C /dev/shm/keys -xf -# Lost host key → decrypt with SOPS_AGE_KEY_FILE=/dev/shm/keys/admin-recovery.txt,# make a new host key, swap its public half in below, `sops updatekeys` every file# in secrets/system/, then shred /dev/shm/keys. Lost user key → restore# ~/.config/sops/age/keys.txt from user-daemonsec.txt in the same bundle.keys:
- &daemonsecage1pu5wcvqqh92xr6ces8zmj4xvs52v7yfm4jsfcxm3z82a32u9n97qesldfv# user - &host_nixosage19xcsle9nqsx45zmw7x4r20kekm456zvtu4puxwf0trwladeq3gvqh4mqw7# laptop host key (2026-10-14) - &adminage1kxzfje79vyx56n58kx3erv9y736zp4syuw4e0c0v2svxfwy4s53qjwzavz# offline recovery (2026-10-14), in the passphrase bundle nixdaemon-age-keys.tar.age on USBcreation_rules:
- path_regex: ^secrets/system/.*# system secrets, incl. secure-vault's header backups (secrets/system/vault-header.sops.json)key_groups:
- age:
- *host_nixos - *admin - path_regex: ^secrets/.*# everything else, incl. whole-file (binary) secrets like secrets/floorp/user.jskey_groups:
- age:
- *daemonsec