diff --git a/nixos/doc/manual/release-notes/rl-2411.section.md b/nixos/doc/manual/release-notes/rl-2411.section.md index f9a5846c1f38..3d1e929205ed 100644 --- a/nixos/doc/manual/release-notes/rl-2411.section.md +++ b/nixos/doc/manual/release-notes/rl-2411.section.md @@ -442,6 +442,9 @@ - `ffmpeg_5` has been removed. Please use the unversioned `ffmpeg`, pin a newer version, or if necessary pin `ffmpeg_4` for compatibility. +- The `rss-bridge` service drops the support to load a configuration file from `${config.services.rss-bridge.dataDir}/config.ini.php`. + Consider using the `services.rss-bridge.config` option instead. + - The `xdg.portal.gtkUsePortal` option has been removed, as it had been deprecated for over 2 years. Using the `GTK_USE_PORTAL` environment variable in this manner is not intended nor encouraged by the GTK developers, but can still be done manually via `environment.sessionVariables`. - The `services.trust-dns` module has been renamed to `services.hickory-dns`. diff --git a/nixos/modules/services/web-apps/rss-bridge.nix b/nixos/modules/services/web-apps/rss-bridge.nix index b03c7f7e8069..9c22b72d31cd 100644 --- a/nixos/modules/services/web-apps/rss-bridge.nix +++ b/nixos/modules/services/web-apps/rss-bridge.nix @@ -5,7 +5,6 @@ let poolName = "rss-bridge"; - configAttr = lib.recursiveUpdate { FileCache.path = "${cfg.dataDir}/cache/"; } cfg.config; cfgHalf = lib.mapAttrsRecursive (path: value: let envName = lib.toUpper ("RSSBRIDGE_" + lib.concatStringsSep "_" path); envValue = if lib.isList value then @@ -14,7 +13,7 @@ let lib.boolToString value else toString value; - in "fastcgi_param \"${envName}\" \"${envValue}\";") configAttr; + in if (value != null) then "fastcgi_param \"${envName}\" \"${envValue}\";" else null) cfg.config; cfgEnv = lib.concatStringsSep "\n" (lib.collect lib.isString cfgHalf); in { @@ -70,9 +69,26 @@ in }; config = mkOption { - type = with types; attrsOf (attrsOf (oneOf [ bool int str (listOf str) ])); - default = {}; - defaultText = options.literalExpression "FileCache.path = \"\${config.services.rss-bridge.dataDir}/cache/\""; + type = types.submodule { + freeformType = (pkgs.formats.ini {}).type; + options = { + system = { + enabled_bridges = mkOption { + type = with types; nullOr (either str (listOf str)); + description = "Only enabled bridges are available for feed production"; + default = null; + }; + }; + FileCache = { + path = mkOption { + type = types.str; + description = "Directory where to store cache files (if cache.type = \"file\")."; + default = "${cfg.dataDir}/cache/"; + defaultText = options.literalExpression "\${config.services.rss-bridge.dataDir}/cache/"; + }; + }; + }; + }; example = options.literalExpression '' { system.enabled_bridges = [ "*" ]; @@ -112,15 +128,13 @@ in }; }; }; - systemd.tmpfiles.settings.rss-bridge = let - perm = { - mode = "0750"; - user = cfg.user; - group = cfg.group; - }; - in { - "${configAttr.FileCache.path}".d = perm; - "${cfg.dataDir}/config.ini.php".z = perm; + + systemd.tmpfiles.settings.rss-bridge = { + "${cfg.config.FileCache.path}".d = { + mode = "0750"; + user = cfg.user; + group = cfg.group; + }; }; services.nginx = mkIf (cfg.virtualHost != null) { @@ -139,7 +153,6 @@ in fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:${config.services.phpfpm.pools.${cfg.pool}.socket}; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param RSSBRIDGE_DATA ${cfg.dataDir}; ${cfgEnv} ''; }; diff --git a/pkgs/servers/web-apps/rss-bridge/default.nix b/pkgs/servers/web-apps/rss-bridge/default.nix index b44ebf088eab..34296541fdf5 100644 --- a/pkgs/servers/web-apps/rss-bridge/default.nix +++ b/pkgs/servers/web-apps/rss-bridge/default.nix @@ -11,10 +11,6 @@ stdenv.mkDerivation rec { sha256 = "sha256-VycEgu7uHYwDnNE1eoVxgaWZAnC6mZLBxT8Le3PI4Rs="; }; - patches = [ - ./paths.patch - ]; - installPhase = '' mkdir $out/ cp -R ./* $out diff --git a/pkgs/servers/web-apps/rss-bridge/paths.patch b/pkgs/servers/web-apps/rss-bridge/paths.patch deleted file mode 100644 index 21747a381bd6..000000000000 --- a/pkgs/servers/web-apps/rss-bridge/paths.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/lib/Configuration.php b/lib/Configuration.php -index 63f67a3c..f0a53a24 100644 ---- a/lib/Configuration.php -+++ b/lib/Configuration.php -@@ -81,8 +81,8 @@ public static function loadConfiguration(array $customConfig = [], array $env = - } - } - -- if (file_exists(__DIR__ . '/../whitelist.txt')) { -- $enabledBridges = trim(file_get_contents(__DIR__ . '/../whitelist.txt')); -+ if (file_exists(getenv('RSSBRIDGE_DATA') . '/whitelist.txt')) { -+ $enabledBridges = trim(file_get_contents(getenv('RSSBRIDGE_DATA') . '/whitelist.txt')); - if ($enabledBridges === '*') { - self::setConfig('system', 'enabled_bridges', ['*']); - } else { -diff --git a/lib/bootstrap.php b/lib/bootstrap.php -index 6465f5f9..4605596f 100644 ---- a/lib/bootstrap.php -+++ b/lib/bootstrap.php -@@ -1,7 +1,7 @@ -