# modules/home/passage.nix — `passage`: a password store, keyed by the age key # the flake already has. # # passage init not needed; the recipients come from the environment # passage insert web/gitlab # passage show web/gitlab passage -c web/gitlab (clipboard, 45s) # passage generate web/newsite 32 # passage ls / passage find gitlab / passage grep token # passage git init && passage git remote add ... # # Why passage and not pass: `pass` is GnuPG, which means the agent, pinentry # and a keyring. passage is the same tool reimplemented on age, and this # machine already keeps an age key for sops-nix. One key, one backup. # # Why it reuses ~/.config/sops/age/keys.txt rather than its own identity: # that file already decrypts every secret the flake has, so pointing passage # at it adds no exposure that is not already there, and -- more importantly -- # no SECOND 189-byte file whose loss is unrecoverable. The alternative, a # dedicated passphrase-protected identity, is in the vault note; it is a real # improvement in compartmentalisation and a real increase in what you must # back up. Switch by changing PASSAGE_IDENTITIES_FILE below. # # This is deliberately NOT where machine secrets live. Anything the system or a # service needs at activation belongs in secrets/secrets.yaml via sops-nix # (modules/home/sops.nix) -- passage needs an interactive shell and your # clipboard, which activation has neither of. passage is for the logins you # type, sops for the values the machine reads. { ... }: { flake.homeModules.passage = { config, pkgs, ... }: let ageKey = "${config.home.homeDirectory}/.config/sops/age/keys.txt"; # The public half of that key. Public by definition -- it is already # committed in ~/NixDaemon/.sops.yaml as the only recipient. Kept here as a # literal for the same reason gpg.nix pins a fingerprint: so a wrong key # cannot be picked up silently from a file that happens to be on disk. recipient = "age1pu5wcvqqh92xr6ces8zmj4xvs52v7yfm4jsfcxm3z82a32u9n97qesldfv"; in { home.packages = [ pkgs.passage ]; home.sessionVariables = { # Defaults are ~/.passage/store and ~/.passage/identities; both are set # explicitly so the store can move without surprises. PASSAGE_DIR = "${config.xdg.dataHome}/passage/store"; PASSAGE_IDENTITIES_FILE = ageKey; # Recipients as an environment variable rather than a .age-recipients # file in the store: it keeps the store a plain directory of .age files # with nothing to commit by accident, and makes the recipient part of the # flake rather than per-checkout state. For per-subdirectory recipients # (sharing one folder with someone else) drop a .age-recipients in that # folder instead -- passage walks up from the entry to find one, and a # file found that way wins over this. PASSAGE_RECIPIENTS = recipient; # pass-compatible knobs passage still honours. PASSWORD_STORE_CLIP_TIME = "45"; # seconds before the clipboard is wiped PASSWORD_STORE_GENERATED_LENGTH = "25"; }; } ; }