summary refs log tree commit diff
path: root/options.nix
diff options
context:
space:
mode:
authorRobert Orr <robert@coffeezombie.com>2025-08-25 13:37:33 -0700
committerRobert Orr <robert@coffeezombie.com>2025-09-02 10:16:00 -0700
commit2d2f73a9257035398e90d32dcfb7db74313d8fe6 (patch)
treedbe956718ecd8aa2b5b9b993833125e542cff104 /options.nix
parent89e48b600b01b21c2fae9c6414ddf66e0c38d7a6 (diff)
Generates 3 different lenghts of secrets, for future use to be written to files.
Change-Id: I314d0350b03fedebeedc7eddedf409a286719486
Diffstat (limited to 'options.nix')
-rw-r--r--options.nix38
1 files changed, 38 insertions, 0 deletions
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";
+        };
+      };
+    });
+  };
+}
+