summary refs log tree commit diff
path: root/options.nix
diff options
context:
space:
mode:
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";
+        };
+      };
+    });
+  };
+}
+