flake parts module for using weyl-ai secrets in a downstream repository.
since this is a private flake, you must add it to your flake's inputs like follows:
inputs.weyl-secrets.url = "git+ssh://git@github.com/weyl-ai/secrets.git";after adding it to your inputs, you should add it as a flakeModule like so:
imports = [
inputs.weyl-secrets.flakeModules.default
];after this, your flake will have been extended with the following:
- a
secretsdevShellwith useful scripts for interacting with secrets nix runbindings for all of those scripts- a
weyl-secretstop level module config option which contains all available secrets
Note: in a downstream flake you will not be able to edit these secrets as they are first copied into the nix store
this flake acts to dogfood the development of it's flake module. hence, the default devShell is bound to the secrets output from the flake module.
using any of the edit-* scripts in this repo will allow editing as expected.
to add a new secret to the repository, use the wvault new command (weyl vault):
wvault newthis will walk you through an interactive prompt:
- secret name: the identifier for your secret (e.g.,
db-password,api-key) - app name: which application this secret belongs to (default:
global). suggestions include:global- organization-wide secretsclient- frontend/client secretsserver- backend/api secrets
- environment (optional): which environment the secret is for. choose from:
dev- development environmentstaging- staging environmentprod- production environment- or skip to use root app level (no environment)
- secret format: how to store the secret:
raw- plain text (string)pem- certificate/key formatenvfile- environment variables (KEY=VALUE pairs)
- secret value:
- for
envfileformat: opens an editor for entering environment variables - for other formats: choose between editor or inline input
- for
the secret will be:
- encrypted using age and stored at
secrets/<app>/<environment>/<name>.age(orsecrets/<app>/<name>.ageif no environment) - added to
inventory.yamlwith metadata about the secret - ready to be generated into
secrets.nixviawvault gen-nix
example: creating a database password for the server app in production:
$ wvault new
✔ Secret name · db-password
✔ App name (default: global) · server
✔ Environment (optional, leave blank to skip) · prod
✔ Format · raw
✔ Use editor to enter value? · yes
# ... editor opens, enter the password, save and close
✓ Created secret: secrets/server/prod/db-password.age
✓ Added to inventory.yamlthen commit the changes:
git add inventory.yaml secrets/<app>/<environment>/<name>.age
git commit -m "add <app> <environment> <name> secret"
git push