Loading nixos/modules/services/networking/sabnzbd/default.nix +24 −9 Original line number Diff line number Diff line Loading @@ -13,7 +13,6 @@ let mkOptionDefault mkIf literalExpression optionalString types ; inherit (lib.generators) Loading Loading @@ -79,7 +78,6 @@ let mkSection = ( depth: attrs: let atoms = extractAtoms attrs; sections = extractSections attrs; sectionHeadingLeft = lib.concatStrings (lib.replicate (depth + 1) "["); sectionHeadingRight = lib.concatStrings (lib.replicate (depth + 1) "]"); Loading @@ -103,7 +101,8 @@ let else (configObjIni { }).generate "public-settings.ini" allSettings; sabnzbdIniPath = "/var/lib/${cfg.stateDir}/sabnzbd.ini"; sabnzbdIniPath = if cfg.configFile != null then cfg.configFile else "/var/lib/${cfg.stateDir}/sabnzbd.ini"; in { Loading @@ -115,8 +114,12 @@ in configFile = mkOption { type = types.nullOr types.path; default = null; description = "Path to config file (deprecated, use `settings` instead)"; default = if lib.versionOlder config.system.stateVersion "26.05" then "/var/lib/sabnzbd/sabnzbd.ini" else null; description = "Path to config file (deprecated, use `settings` instead and set this value to null)"; }; stateDir = mkOption { Loading Loading @@ -511,6 +514,9 @@ in systemd.services.sabnzbd = let files = if cfg.configFile != null then [ sabnzbdIniPath ] else (lib.optional cfg.allowConfigWrite sabnzbdIniPath) ++ [ publicSettingsIni ] ++ cfg.secretFiles; iniPathQuoted = lib.escapeShellArg sabnzbdIniPath; in Loading @@ -531,11 +537,20 @@ in ${lib.toShellVar "files" files} tmpfile=$(mktemp) ${lib.getExe (pkgs.python3.withPackages (py: [ py.configobj ]))} \ ${./config_merge.py} \ "''${files[@]}" | \ install -D -m ${if cfg.allowConfigWrite then "600" else "400"} \ -o '${cfg.user}' -g '${cfg.group}' /dev/stdin ${iniPathQuoted} "''${files[@]}" \ > "$tmpfile" install -D \ -m ${if cfg.allowConfigWrite then "600" else "400"} \ -o '${cfg.user}' -g '${cfg.group}' \ "$tmpfile" \ ${iniPathQuoted} rm "$tmpfile" ''; }; Loading Loading
nixos/modules/services/networking/sabnzbd/default.nix +24 −9 Original line number Diff line number Diff line Loading @@ -13,7 +13,6 @@ let mkOptionDefault mkIf literalExpression optionalString types ; inherit (lib.generators) Loading Loading @@ -79,7 +78,6 @@ let mkSection = ( depth: attrs: let atoms = extractAtoms attrs; sections = extractSections attrs; sectionHeadingLeft = lib.concatStrings (lib.replicate (depth + 1) "["); sectionHeadingRight = lib.concatStrings (lib.replicate (depth + 1) "]"); Loading @@ -103,7 +101,8 @@ let else (configObjIni { }).generate "public-settings.ini" allSettings; sabnzbdIniPath = "/var/lib/${cfg.stateDir}/sabnzbd.ini"; sabnzbdIniPath = if cfg.configFile != null then cfg.configFile else "/var/lib/${cfg.stateDir}/sabnzbd.ini"; in { Loading @@ -115,8 +114,12 @@ in configFile = mkOption { type = types.nullOr types.path; default = null; description = "Path to config file (deprecated, use `settings` instead)"; default = if lib.versionOlder config.system.stateVersion "26.05" then "/var/lib/sabnzbd/sabnzbd.ini" else null; description = "Path to config file (deprecated, use `settings` instead and set this value to null)"; }; stateDir = mkOption { Loading Loading @@ -511,6 +514,9 @@ in systemd.services.sabnzbd = let files = if cfg.configFile != null then [ sabnzbdIniPath ] else (lib.optional cfg.allowConfigWrite sabnzbdIniPath) ++ [ publicSettingsIni ] ++ cfg.secretFiles; iniPathQuoted = lib.escapeShellArg sabnzbdIniPath; in Loading @@ -531,11 +537,20 @@ in ${lib.toShellVar "files" files} tmpfile=$(mktemp) ${lib.getExe (pkgs.python3.withPackages (py: [ py.configobj ]))} \ ${./config_merge.py} \ "''${files[@]}" | \ install -D -m ${if cfg.allowConfigWrite then "600" else "400"} \ -o '${cfg.user}' -g '${cfg.group}' /dev/stdin ${iniPathQuoted} "''${files[@]}" \ > "$tmpfile" install -D \ -m ${if cfg.allowConfigWrite then "600" else "400"} \ -o '${cfg.user}' -g '${cfg.group}' \ "$tmpfile" \ ${iniPathQuoted} rm "$tmpfile" ''; }; Loading