summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2022-12-06 19:45:38 +0100
committertv <tv@krebsco.de>2022-12-06 20:14:39 +0100
commit139c750ee6dd22f4d52d45f3f5e4ee843162833d (patch)
treed4bcba0d20b46c61ba051d533cad05fdd203a90d
parente662c0151398e43a4b344618a819339362568418 (diff)
htgen: add scriptFile option
-rw-r--r--krebs/3modules/htgen.nix21
1 files changed, 18 insertions, 3 deletions
diff --git a/krebs/3modules/htgen.nix b/krebs/3modules/htgen.nix
index 375e2697..1e7e6992 100644
--- a/krebs/3modules/htgen.nix
+++ b/krebs/3modules/htgen.nix
@@ -2,6 +2,12 @@
with import <stockholm/lib>;
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;