From 4cd0c862a782b8d5b90292d88348b767ae78cf1d Mon Sep 17 00:00:00 2001 From: mawalu Date: Fri, 7 Oct 2022 00:00:43 +0200 Subject: [PATCH] Add option --- flake.nix | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 4d4c22f..b7f7ebf 100644 --- a/flake.nix +++ b/flake.nix @@ -38,9 +38,26 @@ config = { baseDomain = mkOption { type = types.str; - description = "Base domain"; + description = "Base domain."; }; }; + + users = mkOption { + type = types.attrsOf (types.submodule { + password = mkOption { + type = types.str; + default = null; + description = "API password for the user"; + }; + }); + example = literalExpression '' + { + "exampleuser" = { + password = "insecure"; + }; + } + ''; + }; }; config = mkIf cfg.enable { @@ -50,7 +67,10 @@ serviceConfig = let pkg = self.packages.${pkgs.system}.default; in { Restart = "on-failure"; - ExecStart = "${pkg}/bin/norbert ${toINI cfg.config}"; + ExecStart = "${pkg}/bin/norbert ${pkg.writeText "config" generators.toINIWithGlobalSection {} { + globalSection = cfg.config; + sections = cfg.users; + }}"; DynamicUser = "yes"; }; };