Add option

This commit is contained in:
Martin 2022-10-07 00:00:43 +02:00
parent 7d23fc01f0
commit 453069a432
Signed by: mawalu
GPG Key ID: BF556F989760A7C8
1 changed files with 25 additions and 2 deletions

View File

@ -38,9 +38,29 @@
config = {
baseDomain = mkOption {
type = types.str;
description = "Base domain";
description = "Base domain.";
};
};
users = mkOption {
default = {};
type = types.attrsOf (types.submodule {
options = {
password = mkOption {
type = types.str;
default = null;
description = "API password for the user";
};
};
});
example = literalExpression ''
{
"exampleuser" = {
password = "insecure";
};
}
'';
};
};
config = mkIf cfg.enable {
@ -50,7 +70,10 @@
serviceConfig = let pkg = self.packages.${pkgs.system}.default;
in {
Restart = "on-failure";
ExecStart = "${pkg}/bin/norbert ${toINI cfg.config}";
ExecStart = "${pkg}/bin/norbert ${pkgs.writeText "config" (generators.toINIWithGlobalSection {} {
globalSection = cfg.config;
sections = cfg.users;
})}";
DynamicUser = "yes";
};
};