htgen: add scriptFile option

This commit is contained in:
tv 2022-12-06 19:45:38 +01:00
parent e662c01513
commit 139c750ee6

View File

@ -2,6 +2,12 @@
with import <stockholm/lib>; with import <stockholm/lib>;
let let
optionalAttr = name: value:
if name != null then
{ ${name} = value; }
else
{};
cfg = config.krebs.htgen; cfg = config.krebs.htgen;
out = { out = {
@ -30,8 +36,15 @@ let
}; };
script = mkOption { script = mkOption {
type = types.str; type = types.nullOr types.str;
default = null;
}; };
scriptFile = mkOption {
type = types.nullOr types.str;
default = null;
};
user = mkOption { user = mkOption {
type = types.user; type = types.user;
default = { default = {
@ -54,8 +67,10 @@ let
after = [ "network.target" ]; after = [ "network.target" ];
environment = { environment = {
HTGEN_PORT = toString htgen.port; HTGEN_PORT = toString htgen.port;
HTGEN_SCRIPT = htgen.script; }
}; // optionalAttr "HTGEN_SCRIPT" htgen.script
// optionalAttr "HTGEN_SCRIPT_FILE" htgen.scriptFile
;
serviceConfig = { serviceConfig = {
SyslogIdentifier = "htgen"; SyslogIdentifier = "htgen";
User = htgen.user.name; User = htgen.user.name;