Skip to content

Commit 511e62f

Browse files
nixos/soju: add option to overwrite generated configFile (#340583)
2 parents 291fe08 + f00f508 commit 511e62f

File tree

1 file changed

+14
-3
lines changed
  • nixos/modules/services/networking

1 file changed

+14
-3
lines changed

nixos/modules/services/networking/soju.nix

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ let
2727
'';
2828

2929
sojuctl = pkgs.writeShellScriptBin "sojuctl" ''
30-
exec ${cfg.package}/bin/sojuctl --config ${configFile} "$@"
30+
exec ${lib.getExe' cfg.package "sojuctl"} --config ${cfg.configFile} "$@"
3131
'';
3232
in
3333
{
@@ -107,7 +107,18 @@ in
107107
extraConfig = mkOption {
108108
type = types.lines;
109109
default = "";
110-
description = "Lines added verbatim to the configuration file.";
110+
description = "Lines added verbatim to the generated configuration file.";
111+
};
112+
113+
configFile = mkOption {
114+
type = types.path;
115+
default = configFile;
116+
defaultText = "Config file generated from other options.";
117+
description = ''
118+
Path to config file. If this option is set, it will override any
119+
configuration done using other options, including {option}`extraConfig`.
120+
'';
121+
example = literalExpression "./soju.conf";
111122
};
112123
};
113124

@@ -134,7 +145,7 @@ in
134145
serviceConfig = {
135146
DynamicUser = true;
136147
Restart = "always";
137-
ExecStart = "${cfg.package}/bin/soju -config ${configFile}";
148+
ExecStart = "${lib.getExe' cfg.package "soju"} -config ${cfg.configFile}";
138149
StateDirectory = "soju";
139150
RuntimeDirectory = "soju";
140151
};

0 commit comments

Comments
 (0)