managing-secrets

Manage encrypted .age secrets across Home Manager and NixOS with agenix.

4|Updated Dec 21, 2025
One-click install
npx skills add https://github.com/greenheadHQ/nixos-config --skill managing-secrets-greenheadhq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: managing-secrets
Source: https://github.com/greenheadHQ/nixos-config/tree/main/.claude/skills/managing-secrets
Command: npx skills add https://github.com/greenheadHQ/nixos-config --skill managing-secrets-greenheadhq

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Manage encrypted secrets across Home Manager and NixOS environments using agenix to securely store and deploy .age files, while handling re-encryption and decryption failures.

Core Features & Use Cases

  • Declarative secret declarations in secrets.nix for both user-level and system-level secrets
  • Two-tier deployment: Home Manager (user space) and NixOS (system services) with controlled distribution
  • Troubleshooting references and best practices to resolve decryption or re-encryption issues
  • Safe deployment workflows that preserve strict file permissions and key management

Quick Start

Add a new secret to secrets.nix, encrypt it with agenix, and deploy it to your Home Manager or NixOS configuration.

Frequently Asked Questions about managing-secrets

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I manage encrypted secrets with agenix in NixOS and Home Manager?

To manage encrypted secrets with agenix, you declaratively declare secret files in a secrets.nix file and deploy them via two tiers: Home Manager for user space and NixOS modules for system-level services. This ensures secure .age file distribution across your hosts.

What is the best way to deploy .age files across multiple NixOS hosts?

Deploying .age files across multiple NixOS hosts requires explicit public keys for all target machines. You encrypt the secrets using agenix, then control re-encryption and distribution declaratively through your NixOS configuration modules.

Does agenix work with both Home Manager and NixOS modules?

Yes, agenix supports a two-tier deployment model that works with both Home Manager and NixOS. This allows you to manage user-level secrets in your user space and system-level secrets for system services independently but through the same declarative workflow.

Why does agenix re-encryption or decryption fail during deployment?

Decryption or re-encryption failures during deployment usually occur when explicit public keys for all hosts are missing or misconfigured in your secrets.nix. The Skill provides troubleshooting references to resolve these key management and permission issues.

How do I add a new secret to my NixOS configuration using agenix?

To add a new secret, you declare it in your secrets.nix file, encrypt the corresponding file with agenix using the target host's public key, and then deploy the updated configuration through Home Manager or your NixOS module.