sops-nix
Atomic secret provisioning for NixOS based on sops
sops-nix Explanation
This project solves a common headache for NixOS users: how to securely manage secrets like passwords, API keys, and database credentials in a reproducible way. It lets you store encrypted secrets alongside your system configuration, decrypt them automatically during deployment, and version-control everything safely without exposing sensitive data.
Here's the core problem it addresses: most systems either require secrets to be kept separately from code (which breaks reproducibility) or require manual steps to inject them at deployment time. sops-nix instead encrypts secrets right in files that can live in your Git repository. The encryption happens once with a master key, and only machines or people with the right decryption key can read them. When you deploy your NixOS system, the tool automatically decrypts these secrets and puts them in the right places with the right permissions, all as part of the normal configuration process.
The tool supports multiple ways to encrypt: you can use GPG keys (the traditional approach), or "age" keys (a newer, simpler encryption method). You can even convert your existing SSH keys into encryption keys, so you don't need to manage a separate set of credentials. It also supports cloud key management services like AWS KMS or Azure Key Vault if you prefer that route. Secrets can be stored in various formats—YAML, JSON, dotenv files, INI files, or even binary—so it fits into different workflows.
Who would use this? Anyone deploying NixOS systems in a team, or anyone who wants their infrastructure configuration in version control without leaking secrets. A small startup might use it to keep database passwords in Git alongside their server config. A DevOps team could use it to ensure every machine has the secrets it needs without manual secret distribution. Home-manager users can also use it for their personal dotfiles. The project emphasizes that secrets are "atomic"—new secrets are written to a temporary directory and swapped in all at once, and if you need to roll back a deployment, the old secrets come back with it.