docs(age): improve readability with structured comments

Add section headers and explanatory comments to clarify the purpose of each configuration block, with emphasis on the critical persistent path requirement for early boot secret decryption.
This commit is contained in:
♥ Minnie ♥ 2025-10-12 10:19:42 +08:00
parent 4389500ccc
commit 9fb72e762b
Signed by: jasmine
GPG key ID: 8563E358D4E8040E

View file

@ -1,3 +1,5 @@
# Agenix secret management with YubiKey rekeying
# Handles encrypted secrets for services requiring credentials
{ {
config, config,
pkgs, pkgs,
@ -6,25 +8,34 @@
}: let }: let
hostname = config.networking.hostName; hostname = config.networking.hostName;
in { in {
# Module imports
imports = [ imports = [
inputs.agenix.nixosModules.default inputs.agenix.nixosModules.default
inputs.agenix-rekey.nixosModules.default inputs.agenix-rekey.nixosModules.default
]; ];
# Overlay provides agenix-rekey package and extensions
nixpkgs.overlays = [ nixpkgs.overlays = [
inputs.agenix-rekey.overlays.default inputs.agenix-rekey.overlays.default
]; ];
# CLI tool for manual secret rekeying operations
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
agenix-rekey agenix-rekey
]; ];
# Secret decryption configuration
# Use persistent paths to ensure SSH keys are available during early boot
# activation, before impermanence bind mounts /etc/ssh/
age.identityPaths = [
"/persist/etc/ssh/ssh_host_rsa_key"
"/persist/etc/ssh/ssh_host_ed25519_key"
];
# YubiKey-based secret rekeying
age.rekey = { age.rekey = {
# Pubkey for rekeying
hostPubkey = ../../${hostname}/ssh_host_ed25519_key.pub; hostPubkey = ../../${hostname}/ssh_host_ed25519_key.pub;
# Master identity used for decryption
masterIdentities = [../users/sajenim/agenix-rekey.pub]; masterIdentities = [../users/sajenim/agenix-rekey.pub];
# Where we store the rekeyed secrets
storageMode = "local"; storageMode = "local";
localStorageDir = ./. + "/secrets/rekeyed/${config.networking.hostName}"; localStorageDir = ./. + "/secrets/rekeyed/${config.networking.hostName}";
}; };