From 139c750ee6dd22f4d52d45f3f5e4ee843162833d Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 6 Dec 2022 19:45:38 +0100 Subject: htgen: add scriptFile option --- krebs/3modules/htgen.nix | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'krebs/3modules/htgen.nix') diff --git a/krebs/3modules/htgen.nix b/krebs/3modules/htgen.nix index 375e26974..1e7e69927 100644 --- a/krebs/3modules/htgen.nix +++ b/krebs/3modules/htgen.nix @@ -2,6 +2,12 @@ with import ; let + optionalAttr = name: value: + if name != null then + { ${name} = value; } + else + {}; + cfg = config.krebs.htgen; out = { @@ -30,8 +36,15 @@ let }; script = mkOption { - type = types.str; + type = types.nullOr types.str; + default = null; + }; + + scriptFile = mkOption { + type = types.nullOr types.str; + default = null; }; + user = mkOption { type = types.user; default = { @@ -54,8 +67,10 @@ let after = [ "network.target" ]; environment = { HTGEN_PORT = toString htgen.port; - HTGEN_SCRIPT = htgen.script; - }; + } + // optionalAttr "HTGEN_SCRIPT" htgen.script + // optionalAttr "HTGEN_SCRIPT_FILE" htgen.scriptFile + ; serviceConfig = { SyslogIdentifier = "htgen"; User = htgen.user.name; -- cgit v1.2.3 From 0802657364bc232fb8009bbecc7b2516bcb6dc09 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 12 Dec 2022 18:34:00 +0100 Subject: htgen: scriptFile should be package or pathname --- krebs/3modules/htgen.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'krebs/3modules/htgen.nix') diff --git a/krebs/3modules/htgen.nix b/krebs/3modules/htgen.nix index 1e7e69927..b760ea671 100644 --- a/krebs/3modules/htgen.nix +++ b/krebs/3modules/htgen.nix @@ -41,7 +41,7 @@ let }; scriptFile = mkOption { - type = types.nullOr types.str; + type = types.nullOr (types.either types.package types.pathname); default = null; }; -- cgit v1.2.3