con un clic
add-secret
// Use this skill when the user wants to add a new agenix secret to this NixOS config repository.
// Use this skill when the user wants to add a new agenix secret to this NixOS config repository.
Use this skill when the user wants to enable an existing NixOS module on one or more hosts in this config repository.
Use this skill when the user wants to add a new host (workstation, laptop, server, or VPS) to this NixOS config repository.
Use this skill when the user asks to add a new NixOS module, create a module for an application, or install a new package with persistent state in this nixos config repository.
| name | add-secret |
| description | Use this skill when the user wants to add a new agenix secret to this NixOS config repository. |
| argument-hint | <secret-name> <dir> <host-or-group> [host-or-group ...] |
| allowed-tools | ["Read","Write","Edit","Glob","Grep","Bash"] |
The user wants to add a new secret managed by agenix. Arguments: $ARGUMENTS
Parse the arguments:
my-service-token, wireguard-private-key)secrets/ (e.g., server-main-elis, workstations, any)desktop-elis, laptop-private-elis, laptop-work-elis, desktop-caroline, laptop-private-caroline, server-main-elis, server-sparv, vps06all, workstationsIf arguments are missing or ambiguous, ask the user before proceeding.
secrets-registry.nix is the single source of truth. It defines all secrets with their file path and hostKeys (the SSH public keys allowed to decrypt them). From it, secrets.nix and config.etu.data.ageModules are derived automatically.
The etu user keys (desktop-elis, laptop-private-elis, laptop-work-elis) are always prepended to every secret's hostKeys — they're defined as etu in the registry's let block.
Tell the user to run this command interactively (it opens an editor):
agenix -e secrets/<dir>/<secret-name>.age
Instruct them to type ! agenix -e secrets/<dir>/<secret-name>.age in the Claude Code prompt to run it in the session, then enter the secret value in the editor that opens.
Wait for the user to confirm the file was created before proceeding.
Read secrets-registry.nix to understand the current structure and find the right section to insert the new entry.
Choose the insertion point:
<dir> (e.g., # server-main-elis secrets)}The standard entry shape is:
<secret-name> = {
file = ./secrets/<dir>/<secret-name>.age;
hostKeys = etu ++ h.<host-or-group>;
};
For multiple hosts: hostKeys = etu ++ h.host1 ++ h.host2;
Optional fields (only add if the user specified them):
owner = "<unix-user>"; — if the secret must be owned by a specific system usergroup = "<unix-group>";mode = "0400"; — default is already 0400, only set if differentpath = "/explicit/path"; — if the secret must land at a specific path (not the default /run/agenix/)symlink = false; — required when path points into a ZFS persist datasetUse the Edit tool to insert the new block at the chosen location in secrets-registry.nix. Keep the existing section's style (blank line between entries, correct indentation of 2 spaces).
Run:
git add secrets/<dir>/<secret-name>.age
Explain to the user how to reference the secret from a NixOS module or host config:
In a host's configuration.nix (makes the secret available at runtime):
age.secrets = {
inherit (config.etu.data.ageModules) <secret-name>;
};
In a NixOS module or service config (reference the decrypted path):
someOption = config.age.secrets.<secret-name>.path;
etu variable in secrets-registry.nix already covers the three personal computer user keys — never add those as individual h.<host> entries..age file must exist on disk before nix flake check will pass.syncoid, nextcloud), remind the user to set owner.path pointing into /data/... (ZFS persist) need symlink = false.