From 2d2f73a9257035398e90d32dcfb7db74313d8fe6 Mon Sep 17 00:00:00 2001 From: Robert Orr Date: Mon, 25 Aug 2025 13:37:33 -0700 Subject: Generates 3 different lenghts of secrets, for future use to be written to files. Change-Id: I314d0350b03fedebeedc7eddedf409a286719486 --- options.nix | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 options.nix (limited to 'options.nix') diff --git a/options.nix b/options.nix new file mode 100644 index 0000000..044833b --- /dev/null +++ b/options.nix @@ -0,0 +1,38 @@ + +{ pkgs, lib }: + +let + scriptRegistry = { + bigsecret = ''head -c 64 /dev/urandom | base32''; + medsecret = ''head -c 32 /dev/urandom | base32''; + smallsecret = ''head -c 16 /dev/urandom | base32''; + }; +in { + secrets.secrets = lib.mkOption { + description = '' + A set of secrets, each identified by a name (e.g. mattermost, gitlabce). + Each secret has a filename and a script to generate it. + ''; + default = { }; + type = lib.types.attrsOf (lib.types.submodule { + options = { + filename = lib.mkOption { + type = lib.types.str; + description = '' + The filename where this secret is stored, all + files at /etc/nixos/secrets + ''; + example = "mysecret.key"; + }; + script = lib.mkOption { + type = lib.types.str; + description = '' + Shell command that generates the secret. + "; + example = "head -c 32 /dev/urandom | base32"; + }; + }; + }); + }; +} + -- cgit 1.4.1