nixos/soju: add option to overwrite generated configFile (#340583)

authored by Sandro and committed by GitHub 511e62f5 291fe081

+14 -3
+14 -3
nixos/modules/services/networking/soju.nix
··· 27 27 ''; 28 28 29 29 sojuctl = pkgs.writeShellScriptBin "sojuctl" '' 30 - exec ${cfg.package}/bin/sojuctl --config ${configFile} "$@" 30 + exec ${lib.getExe' cfg.package "sojuctl"} --config ${cfg.configFile} "$@" 31 31 ''; 32 32 in 33 33 { ··· 107 107 extraConfig = mkOption { 108 108 type = types.lines; 109 109 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"; 111 122 }; 112 123 }; 113 124 ··· 134 145 serviceConfig = { 135 146 DynamicUser = true; 136 147 Restart = "always"; 137 - ExecStart = "${cfg.package}/bin/soju -config ${configFile}"; 148 + ExecStart = "${lib.getExe' cfg.package "soju"} -config ${cfg.configFile}"; 138 149 StateDirectory = "soju"; 139 150 RuntimeDirectory = "soju"; 140 151 };