Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
2439c9d
nixos-vars: Init
prescientmoon Jun 5, 2026
a03772f
nixos-vars: Set up nix evaluation
prescientmoon Jun 5, 2026
3c571ea
nixos-vars: Attempt to implement the proper logic for evaluating conf…
prescientmoon Jun 5, 2026
b9cc660
nixos-vars: Add a comment explaining the stub target-host-nixpkgs import
prescientmoon Jun 5, 2026
daa8644
nixos-vars: Delete some older code
prescientmoon Jun 5, 2026
5007ad2
nixos-vars: Add a flake example
prescientmoon Jun 19, 2026
3583718
nixos-vars: Improve NixOS module
prescientmoon Jun 19, 2026
4071077
nixos-vars: Explicitly set Python styling parameters
prescientmoon Jun 19, 2026
102c75a
nixos-vars: Implement config evaluation, including flake support
prescientmoon Jun 19, 2026
58b788f
nixos-vars: Add support for direct JSON input
prescientmoon Jun 19, 2026
45a15e5
nixos-vars: Remove --nixpkgs arg
prescientmoon Jun 19, 2026
31835e5
nixos-vars: Fix up example
prescientmoon Jun 19, 2026
1cfd433
nixos-vars: Compute the evaluation order
prescientmoon Jun 24, 2026
e146655
nixos-vars: Make variable casing consistent
prescientmoon Jun 24, 2026
1f699cf
nixos-vars: Implement rebuild order computation & checking whether fi…
prescientmoon Jun 24, 2026
1e910dd
nixos-vars: Implement generation logic for secrets
prescientmoon Jun 24, 2026
f40e08b
nixos-vars: Add rudimentary error handling to generation logic
prescientmoon Jun 24, 2026
17d2198
nixos-vars: Make generation logic respec --dry-run
prescientmoon Jun 24, 2026
63f122c
nixos-vars: Package the CLI using Nix
prescientmoon Jul 1, 2026
5192f1e
nixos-vars: Proper error messages for script failure + pick a unique …
prescientmoon Jul 1, 2026
17db18c
nixos-vars: Support non root store paths for deferred packages
prescientmoon Jul 1, 2026
d7a94e0
nixos-vars: Implement garbage collection
prescientmoon Jul 1, 2026
a272c57
nixos-vars: Add a basic NixOS test
prescientmoon Jul 1, 2026
5585533
nixos-vars: Implement the "regenerate" command
prescientmoon Jul 1, 2026
3247215
nixos-vars: Fix test
prescientmoon Jul 1, 2026
6c62e01
nixos-vars: Remove scuffed postInstall in favour of setuptools.packag…
prescientmoon Jul 1, 2026
c08f494
nixos-vars: Merge generate and regenerate into a single command
prescientmoon Jul 7, 2026
af07a3c
nixos-vars: Add bubblewrap support
prescientmoon Jul 7, 2026
9fb943b
nixos-vars: Run fixup scripts
prescientmoon Jul 7, 2026
5e66c46
nixos-vars: Improve the docs slightly
prescientmoon Jul 7, 2026
75f123d
nixos-vars: Implement prompts
prescientmoon Jul 7, 2026
15ba998
nixos-vars: Bump python version
prescientmoon Jul 7, 2026
0fcf4a2
nixos-vars: Add rudimentary deploy script support
prescientmoon Jul 7, 2026
d9e3cfe
nixos-vars: Update test for the meeting
prescientmoon Jul 7, 2026
2707f94
nixos-vars: Oops, the test should pass now! (with no sandbox though :…
prescientmoon Jul 7, 2026
59a52d9
nixos-vars: Attempt to use closureInfo
prescientmoon Jul 7, 2026
252c74a
nixos-vars: Attempt to make the test pass within the Nix sandbox
prescientmoon Jul 9, 2026
4e5e300
nixos-vars: Bind mount more paths in the bubblewrap sandbox
prescientmoon Jul 9, 2026
cf9d4b4
nixos-vars: Make the test pass
prescientmoon Jul 9, 2026
7081aaa
nixos-vars: Abstract away the closure computation used by the tests
prescientmoon Jul 9, 2026
647ed69
nixos-vars: Support local deployments
prescientmoon Jul 14, 2026
a29852b
nixos-vars: Add test for local deployment
prescientmoon Jul 14, 2026
2b4f766
nixos-vars: Implement a simple age backend
prescientmoon Jul 15, 2026
1f13743
nixos-vars: move module to the NixOS module tree
prescientmoon Jul 21, 2026
e2e957a
nixos-vars: implement age backend local deployments & pass file list …
prescientmoon Jul 21, 2026
28d78d0
nixos-vars: make logs slightly more consistent
prescientmoon Jul 21, 2026
f76bf65
nixos-vars: remove generatorModule in favour of the built-in way of m…
prescientmoon Jul 21, 2026
dbe25c8
nivos-vars: write a scuffed demo deploy script for the age backend
prescientmoon Jul 22, 2026
7383c89
nixos-vars: remove the unused --yes option
prescientmoon Jul 22, 2026
8a3102a
nixos-vars: start writing some docs
prescientmoon Jul 22, 2026
5526a33
nixos-vars: write a bit more of the docs
prescientmoon Jul 23, 2026
61da959
nixos-vars: clean up examples slightly
prescientmoon Jul 23, 2026
bea3061
nixos-vars: clean up example directory a bit further
prescientmoon Jul 23, 2026
99b24ae
nixos-vars: add docs about the vars schema
prescientmoon Jul 23, 2026
5bbdc91
nixos-vars: make a few more things optional, and start working on the…
prescientmoon Jul 23, 2026
ce63855
nixos-vars: improve docs (slightly)
prescientmoon Jul 23, 2026
a6746cd
nixos-vars: Remove {shell,default}.nix
prescientmoon Aug 3, 2026
e257890
nixos-vars: remove example entrypoints that reference the current nix…
prescientmoon Aug 3, 2026
60a869a
nixos-vars: fix the thingies treefmt was complaining about
prescientmoon Aug 3, 2026
ac0ae23
nixos-vars: move test to the proper spot + fix some dangling paths
prescientmoon Aug 3, 2026
6d3d2a9
nixos-vars: fix arg parsing for `--set`
prescientmoon Aug 3, 2026
96730d2
nixos-vars: remove lib.fileset usage
prescientmoon Aug 3, 2026
c31a1c5
nixos-vars: make age backend file extraction atomic
prescientmoon Aug 5, 2026
45890b9
meta: add myself to the maintainer list
prescientmoon Aug 5, 2026
1d4257b
nixos-vars: add meta attribute
prescientmoon Aug 5, 2026
6dd5919
nixos-vars: improve docs & incorporate more PR feedback
prescientmoon Aug 5, 2026
fea0c56
nixos-vars: improve phrasing a bit
prescientmoon Aug 5, 2026
44abd4e
nixos-vars: enlarge the code snippet explaining how to write a genera…
prescientmoon Aug 5, 2026
6bcc599
nixos-vars: remove editorconfig file
prescientmoon Aug 5, 2026
4ba74a2
nixos-vars: remove gitignore
prescientmoon Aug 5, 2026
6017235
nixos-vars: remove ruff config (?)
prescientmoon Aug 5, 2026
d4ccad0
nixos-vars: reformat everything to match the root .editorconfig
prescientmoon Aug 5, 2026
c524600
nixos-vars: remove TODO related to merging from the age backend
prescientmoon Aug 5, 2026
c34c368
nixos-vars: add example `identity.target` to age backend
prescientmoon Aug 5, 2026
09710c3
nixos-vars: pass both labels and descriptions to prompt scripts
prescientmoon Aug 10, 2026
93de1e1
nixos-vars: make `fixup` a batch operation
prescientmoon Aug 10, 2026
9dd8e79
nixos-vars: remove age from devshell
prescientmoon Aug 10, 2026
5606de0
nixos-vars: remove unused arg
prescientmoon Aug 10, 2026
e8f627c
nixos-vars: use the old CLI when --flake is not used
prescientmoon Aug 10, 2026
6c24add
nixos-vars: change test to not enable the new CLI
prescientmoon Aug 10, 2026
4d772bc
nixos-vars: do not use --impure
prescientmoon Aug 10, 2026
7341343
nixos-vars: replace `nix-vars` with `nixos-vars` everywhere
prescientmoon Aug 10, 2026
d050f9d
nixos-vars: also replace `nix_vars` -> `nixos_vars`
prescientmoon Aug 10, 2026
8f00619
nixos-vars: rename `deploy` -> `local` and remove the unused `secret`…
prescientmoon Aug 16, 2026
89f634f
nixos-vars: `deploy` -> `deploy.remote`, `deployLocal` -> `deploy.local`
prescientmoon Aug 18, 2026
ef83dcd
nixos-vars: fix naming inconsistencies with `delayedPackage` and `def…
prescientmoon Aug 18, 2026
7c23ff0
nixos-vars: fix invalid usage of `writeShellScript` in examples
prescientmoon Aug 18, 2026
fdbed44
nixos-vars: fix failing test
prescientmoon Aug 18, 2026
7cf936e
nixos-vars: tiny var name changes (as discussed in the meeting)
prescientmoon Aug 18, 2026
e8c6629
nixos-vars: don't directly import <nixpkgs> as a fallback, thus getti…
prescientmoon Aug 18, 2026
9d063ee
nixos-vars: allow mutating names in the NixOS module (instead of alwa…
prescientmoon Aug 18, 2026
a1083c3
nixos-vars: do not fail on the first fixup script error
prescientmoon Aug 18, 2026
29f3456
nixos-vars: enable __structuredAttrs in order to make nixpkgs-vet happy
prescientmoon Aug 18, 2026
44c834c
nixos-vars: better `safeName` error messages & check the names on the…
prescientmoon Aug 19, 2026
6c34f61
nixos-vars: try to add more comments to `jsonify.nix`, explaining som…
prescientmoon Aug 19, 2026
1510538
nixos-secrets: rename from `nixos-vars`
prescientmoon Aug 19, 2026
bf2ca64
nixos-secrets: extract common example backends into their own directory
prescientmoon Aug 19, 2026
042be5d
nixos-secrets: add an example of how one can tack structured IDs on t…
prescientmoon Aug 19, 2026
c1a5b1d
nixos-secrets: use "with lib.types" in the module
prescientmoon Aug 19, 2026
673289b
nixos-secrets: rename the `!local` flag back to `deploy`
prescientmoon Aug 20, 2026
0b8e389
nixos-secrets: add safety comments to examples
prescientmoon Aug 20, 2026
5ca2a69
nixos-secrets: write jsonschema for secrets configurations
prescientmoon Aug 20, 2026
da6355a
nixos-secrets: rework naming structure
prescientmoon Aug 21, 2026
1a43068
nixos-secrets: make prompt names `safeName`s
prescientmoon Aug 21, 2026
6805332
nixos-secrets: fix bad arg description
prescientmoon Aug 21, 2026
28d8fc9
nixos-secrets: remove reference to never-captured stderr when running…
prescientmoon Aug 21, 2026
2638a44
nixos-secrets: fix failure to retrieve files being attributed to the …
prescientmoon Aug 21, 2026
d9ea6e9
nixos-vars: error out on secret with no files
prescientmoon Aug 25, 2026
2921e05
nixos-secrets: implement --set and checking whether files have actual…
prescientmoon Aug 25, 2026
d6c1234
nixos-secrets: quote file name in error message
prescientmoon Aug 25, 2026
8863f16
nixos-secrets: generator script timeouts
prescientmoon Aug 25, 2026
bbc83d7
nixos-secrets: pass info required for git-root detection via env vars
prescientmoon Aug 25, 2026
81bafcc
nixos-secrets: pass `--die-with-parent` to bwrap
prescientmoon Aug 25, 2026
e9550db
nixos-secrets: probe for bwrap before using it
prescientmoon Aug 25, 2026
79a05ba
nixos-secrets: testing prompt backend
prescientmoon Aug 26, 2026
1f83507
nixos-secrets: reset terminal state after running user commands
prescientmoon Aug 26, 2026
781a47e
nixos-secrets: improve docs related to the prompt backend changes
prescientmoon Aug 26, 2026
5243bc4
nixos-secrets: pass empty stdin to generator scripts
prescientmoon Aug 26, 2026
3576171
nixos-secrets: crash if bwrap is avaiable and --no-sandbox is not given
prescientmoon Aug 28, 2026
7d8c30d
nixos-secrets: proper consistency checks
prescientmoon Aug 28, 2026
86d0904
nixos-secrets: move examples to modulesPath and make test use said ex…
prescientmoon Aug 28, 2026
110c89f
nixos-secrets: make the test pass
prescientmoon Sep 2, 2026
3af061f
nixos-secrets: rewrite the plain-text backend from Bash to Python
prescientmoon Sep 2, 2026
5e62fb0
nixos-secrets: rework docs
prescientmoon Sep 9, 2026
4ad0d51
nixos-secrets: fix tests
prescientmoon Sep 9, 2026
4b0f1db
nixos-secrets: fix docs
prescientmoon Sep 11, 2026
fc944d5
nixos-secrets: remove the `exists` script in favour of `list`
prescientmoon Sep 11, 2026
4daa0f6
nixos-secrets: explain when bad things might happen
prescientmoon Sep 11, 2026
bec2d65
nixos-secrets: doc fixes
prescientmoon Sep 16, 2026
133443f
nixos-secrets: make the name attributes readOnly
prescientmoon Sep 18, 2026
b048fe9
nixos-secrets: add a few missing defaultText attributes to the module
prescientmoon Sep 18, 2026
76a5984
nixos-secrets: auto-failing backend
prescientmoon Sep 22, 2026
12cc227
nixos-secrets: add failure recovery test
prescientmoon Sep 22, 2026
14ef983
nixos-secrets: ensure --set is not used on secrets that have dependen…
prescientmoon Sep 23, 2026
d41eb27
nixos-secrets: clarify what the 'ask' script is meant to do
prescientmoon Sep 23, 2026
f8c9542
nixos-secrets: minimize references to the word "generator"
prescientmoon Sep 23, 2026
d5578ad
nixos-secrets: explain the "target" and "host" terminology
prescientmoon Sep 23, 2026
f8efb01
nixos-secrets: document the age backend a bit better
prescientmoon Sep 23, 2026
69aa792
nixos-secrets: Explain why the age keys in the example are the way th…
prescientmoon Sep 23, 2026
9fd1e28
nixos-secrets: fix the meta.mainProgram warnings for the plain backend
prescientmoon Sep 23, 2026
bd8abb9
nixos-secrets: add QOL single-file shortcut for `--set`
prescientmoon Sep 23, 2026
799e15d
nixos-secrets: Improve doc wording
prescientmoon Sep 23, 2026
5c8e61a
nixos-secrets: fix outdated doc script attribute naming
prescientmoon Sep 26, 2026
eb67958
nixos-secrets: fix unintentional lie about `get` being optional
prescientmoon Sep 26, 2026
6e70d0b
nixos-secrets: remove accidentally committed error message
prescientmoon Sep 28, 2026
b9d40ac
nixos-secrets: remove useless __pycache__
prescientmoon Sep 28, 2026
5874d1f
nixos-secrets: move all the scripts to pkgs.writeShellScript
prescientmoon Sep 28, 2026
cb7d110
nixos-secrets: remove references to deprecated typing thingies
prescientmoon Sep 28, 2026
068e85d
nixos-secrets: fix tests
prescientmoon Sep 28, 2026
5ddcee4
nixos-secrets: fix the simple prompt backend not having access to $ED…
prescientmoon Sep 28, 2026
2539c73
nixos-secrets: garbage collect metadata files (when everything else i…
prescientmoon Sep 28, 2026
1bdb92c
nixos-secrets: Fix ruff linting errors
prescientmoon Oct 29, 2026
f9b8e16
nixos-secrets: Fix mypy errors & add checks to checkPhase
prescientmoon Oct 29, 2026
f725800
nixos-secrets: make scripts take an object instead of a single arg
prescientmoon Oct 29, 2026
1de9b0d
nixos-secrets: fix silly option naming mistake
prescientmoon Oct 29, 2026
09abedb
nixos-secrets: fix "config" appearing in some doc paths instead of "c…
prescientmoon Oct 29, 2026
b4b6d00
nixos-secrets: warn about evaluation cycles
prescientmoon Oct 29, 2026
874975f
nixos-secrets: fix formatting
prescientmoon Oct 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23420,6 +23420,13 @@
githubId = 11898437;
name = "Florian Ströger";
};
prescientmoon = {
email = "nix@moonythm.dev";
matrix = "@prescientmoon:moonythm.dev";
github = "prescientmoon";
githubId = 39400800;
name = "prescientmoon";
};
presto8 = {
name = "Preston Hunt";
email = "me@prestonhunt.com";
Expand Down
346 changes: 346 additions & 0 deletions nixos/modules/security/secrets/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,346 @@
{ lib, config, ... }:
with lib.types;
let
# A name containing only "safe" characters that we allow passing to the
# backends.
#
# Note that we often default options of type `safeName` to Nix attribute
# names. For example,
# ```
# secrets.store."foo bar" = {}
# ```
# will implicitly set `secrets.store."foo bar".name = "foo bar"`. This is
# bad, because the error will get a confusing error coming from the wrong
# place. In the future, it might be worth creating a modified version of
# `attrsOf` that does not have this issue, although the added complexity is
# not worth it right now.
safeName =
of:
addCheck str (
s:
if lib.strings.match "^[a-zA-Z0-9:_\\.-]+$" s == null then
throw "Name '${toString s}' is not a valid ${of} name. Currently, only alphanumeric characters, dashes, underscores, and dots are allowed."
else
true
);
cfg = config.secrets;

deferredPackage =
description:
lib.mkOption {
inherit description;
type = functionTo pathInStore;
example = { pkgs, ... }: pkgs.writeShellScript "example" "echo 'Hi!'";
};

nullableDeferredPackage =
description:
lib.mkOption {
inherit description;
type = nullOr (functionTo pathInStore);
example = { pkgs, ... }: pkgs.writeShellScript "example" "echo 'Hi!'";
default = null;
};

storeBackendModule = submodule (
{ name, ... }:
{
options = {
name = lib.mkOption {
description = "The name of the backend.";
type = str;
default = name;
defaultText = "Attribute name of the backend";
readOnly = true;
};

get = deferredPackage ''
Given $1=gen_name and $2=file_name, the script retrieves the
respective secret to $out.
'';

set = deferredPackage ''
Given $1=gen_name and $2=file_name, the script retrieves the
respective secret from $in and stores it in the appropriate location.
'';

delete = nullableDeferredPackage ''
Given $1=gen_name and $2=file_name, the script deletes the respective
secret if it does exist.
'';

list = deferredPackage ''
A script that lists all files managed by this backend. Should output
space-separated or newline-separated pairs of: secret_name
file_name.

If the backend supports multiple hosts, then this command should only
list the secrets owned by the current host. In particular, files
included in this command's output will be deleted by the
collect-garbage command, unless they appear in the user's secret
configuration.

This script must not perform side effects.
'';

fixup = nullableDeferredPackage ''
This script will be run on every invocation of the CLI's "generate"
command. Given $1=file_list in the same format used by `list`, the
script performs any necessary updates to the secrets' files (e.g.
rekeying encrypted secrets). This script can perform side effects,
but must be idempotent.
'';

deploy.remote = nullableDeferredPackage ''
Deploys every available file to the given machine. The list of files
to deploy is provided as $1 in the same format used by `list`. Any
additional information required by the deploy script can be provided
by the user through environment variables.
'';

deploy.local = nullableDeferredPackage ''
Deploys every available file to the machine with system root mounted
at $1=system_root. The list of files to deploy is provided as $2 in
the same format used by `list`. This is useful for fresh installs
from environments live live CDs, where the target system is not yet
up and running (even if nixos-install has successfully completed).
'';

fileModule = lib.mkOption {
type = deferredModule;
internal = true;
default = { };
description = ''
A module to be imported in every
secrets.store.<name>.files.<name> submodule. Used by backends to
define the `path` attribute. The module will have the following
additional arguments passed to it:
- `secret`, containing the secret the file belongs to
- `backend`, containing the backend associated with said secret
'';
};
};
}
);

fileModule =
{ name, backend, ... }:
{
imports = [ backend.fileModule ];
options = {
name = lib.mkOption {
description = "name of the file";
type = safeName "file";
default = name;
defaultText = "Attribute name of the file";
readOnly = true;
};

path = lib.mkOption {
description = "Path to the file; usually set by the backend";
type = path;
};

deploy = lib.mkOption {
description = ''
Files with this flag will be included in the file list passed to
the `deploy` script.
'';
type = bool;
default = true;
};
};
};

secretModule = submodule (
{ name, config, ... }:
let
backend = cfg.backends.store.${config.backend};
in
{
options = {
name = lib.mkOption {
description = ''
The name of the secret. This name will be used to refer to the
the secrets from other generators.
'';
type = safeName "secret";
default = name;
defaultText = "Attribute name of the secret";
readOnly = true;
};

backend = lib.mkOption {
type = str;
description = "The backend responsible for handling this secret.";
default = cfg.backends.defaults.store;
};

prompts = lib.mkOption {
description = ''
A set of prompts the generator will have at its disposal.
'';
default = { };
type = attrsOf promptModule;
};

dependencies = lib.mkOption {
description = ''
A list of other secrets this generator should be able to read the
output(s) of.
'';
type = listOf (safeName "secret");
default = [ ];
};

files = lib.mkOption {
description = ''
A set of files to store. The generator 'script' is expected to
produce exactly these files under $out.
'';
default = { };
type = attrsOf (submoduleWith {
modules = [ fileModule ];
specialArgs = {
inherit backend;
secret = config;
};
});
};

generate = nullableDeferredPackage ''
The script to run to generate the files. The script will be run with
the following environment variables:
- $in: The directory containing the output values of all declared
dependencies
- $out: The output directory to put the generated files
- $prompts: The directory containing the prompted values as files
The script should produce the files specified in the 'files' attribute
under $out.
'';
};
}
);

promptBackendModule = submodule (
{ name, ... }:
{
options = {
name = lib.mkOption {
description = "The name of the backend.";
type = str;
default = name;
defaultText = "Attribute name of the backend";
readOnly = true;
};

ask = deferredPackage ''
Given $1=secret_name, $2=prompt_name, $3=prompt_type,
$4=prompt_label, and optionally $5=prompt_description, the script
runs the prompt by the user, then saves respective value to $out.

Do note that the given $2=prompt_name is not meant as a prompt label!
$4=prompt_label should be used for that purpose. Indeed, $1 and $2
are only really useful for non-interactive usecases.
'';
};
}
);

promptModule = submodule (
{ name, ... }:
{
options = {
name = lib.mkOption {
Comment thread
prescientmoon marked this conversation as resolved.
Resolved
description = "The prompt's name.";
type = safeName "prompt";
default = name;
defaultText = "Attribute name of the prompt";
readOnly = true;
};

label = lib.mkOption {
description = "The label to attach to the prompt.";
type = str;
default = name;
};

description = lib.mkOption {
description = ''
An optional longer description of the prompted value.
'';
type = nullOr str;
default = null;
example = "SSH private key";
};

type = lib.mkOption {
description = ''
The input type of the prompt.
The following types are available:
- hidden: A hidden text (e.g. password)
- line: A single line of text
- multiline: A multiline text
'';
type = enum [
"hidden"
"line"
"multiline"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multiline-hidden is missing here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, how would a backend handle this in practice? The idea with multiline was that a backend would, for example, open the file in $EDITOR.

Still, if multiline-hidden is something people commonly need, I'd be open to adding it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openssh private keys are encoded into multiple lines for example. So if you'd want to paste one for whatever reason, it would need that input mode. clan-core implements that by having the user paste into a blind (non echoing) terminal, then finish with Ctrl+D. The $EDITOR should not be used for secrets as it might cache it or heep a history of some sorts.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I see the point regarding $EDITOR. I think sops-nix and the like do use $EDITOR for this kind of stuff though. Is that just a bad practice that's already common place?

];
default = "line";
};

backend = lib.mkOption {
type = str;
description = "The backend responsible for handling this prompt.";
default = cfg.backends.defaults.prompt;
};
};
}
);
in
{
options.secrets = {
store = lib.mkOption {
description = ''
A set of secrets that are each expected to store a set of files
under a directory. Generators can produce files using a script,
possibly referencing values produced by other generators and user
input. The secrets can also be manually imported from external files
using the CLI.
'';
default = { };
type = attrsOf secretModule;
};

backends.store = lib.mkOption {
description = ''
A set of backends that handle storing and retrieving secret files.
'';
default = { };
type = attrsOf storeBackendModule;
};

backends.defaults.store = lib.mkOption {
description = ''
The default backend to use for secrets that do not specify one.
'';
type = str;
};

backends.prompt = lib.mkOption {
description = ''
A set of backends that handle retrieving user inputs.
'';
default = { };
type = attrsOf promptBackendModule;
};

backends.defaults.prompt = lib.mkOption {
description = ''
The default backend to use for prompts that do not specify one.
'';
type = str;
};
};
}
1 change: 1 addition & 0 deletions nixos/modules/security/secrets/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This directory contains a bunch of examples of how one might use the `nixos-secrets` module. These are placed here such that the associated nixos-test(s) can reference the example backends via the `modulesPath` (as suggested by Lassulus).
Loading
Loading