I am trying to run both fresh-rss and rss-bridge in path localhost/rss and localhost/bridge.
individually both work but i was trying to host them with same server on my laptop(not a seperate setup). the config for that i was trying to work on is below(will not work directly).
Any recommendation are welcome.
{lib, config, pkgs, ...}:
let
freshrss_package = pkgs.freshrss;
freshrss = ./freshrss.nix;
bridge_package = pkgs.rss-bridge;
freshrss_pool = "freshrss";
freshrss_url_path = "rss";
bridge_config={
system.enabled_bridges = [ "*" ];
FileCache = {
enable_purge = true;
};
};
cfgHalf = lib.mapAttrsRecursive (path: value: let
envName = lib.toUpper ("RSSBRIDGE_" + lib.concatStringsSep "_" path);
envValue = if lib.isList value then
lib.concatStringsSep "," value
else if lib.isBool value then
lib.boolToString value
else
toString value;
in if (value != null) then "fastcgi_param \"${envName}\" \"${envValue}\";" else null) bridge_config;
cfgEnv = lib.concatStringsSep "\n" (lib.collect lib.isString cfgHalf);
in
{
#imports = [ ./freshrss.nix ];
#disabledModules = [ "services/web-apps/freshrss.nix" ];
#set my own virtualHost
#copy from nixpkgs and merge
services.nginx = {
enable = true;
virtualHosts.localhost = {
# php files handling
# this regex is mandatory because of the API
/*
locations."~ ^/${freshrss_url_path}/.+?\.php(/.*)?$"={
root = "${freshrss_package}/p";
extraConfig = ''
fastcgi_pass unix:${config.services.phpfpm.pools.${freshrss_pool}.socket};
fastcgi_split_path_info ^/${freshrss_url_path}(/.+\.php)(/.*)?$;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include ${pkgs.nginx}/conf/fastcgi_params;
include ${pkgs.nginx}/conf/fastcgi.conf;
'';
};
locations."~ ^/${freshrss_url_path}(?!.*\.php)(/.*)?$" = {
root = "${freshrss_package}/p";
tryFiles = "$1 /${freshrss_url_path}$1/index.php$is_args$args";
index = "index.php index.html index.htm";
};*/
locations."/" = {
root = "${bridge_package}";
tryFiles = "$uri /index.php$is_args$args";
};
locations."~ ^/index.php(/|$)" = {
root = "${bridge_package}";
extraConfig = ''
include ${pkgs.nginx}/conf/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:${config.services.phpfpm.pools.${freshrss_pool}.socket};
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
${cfgEnv}
'';
};
#locations."= /" = {
# return = "301 /rss/";
#};
};
};
#add services
services.freshrss = {
enable = true;
baseUrl = "http://localhost/${freshrss_url_path}";#change this to tell the base url is new
passwordFile = pkgs.writeText "password" "secret";
virtualHost = null;#dont setup, use previous
pool = freshrss_pool;
dataDir = "/srv/freshrss";
extensions = [ pkgs.freshrss-extensions.youtube ] ++ [
(pkgs.freshrss-extensions.buildFreshRssExtension rec {
FreshRssExtUniqueId = "ClickableLinks";
pname = "clickable-links";
version = "1.01";
src = pkgs.fetchFromGitHub {
owner = "kapdap";
repo = "freshrss-extensions";
rev = "a44a25a6b8c7f298ac05b8db323bdea931e6e530";
hash = "sha256-uWZi0sHdfDENJqjqTz5yoDZp3ViZahYI2OUgajdx4MQ=";
};
sourceRoot = "${src.name}/xExtension-ClickableLinks";
meta = {
description = "Replaces non-clickable plain text URLs found in articles with clickable HTML links.";
homepage = "https://github.com/kapdap/freshrss-extensions/tree/master/xExtension-ClickableLinks";
};
})
];
};
services.rss-bridge = {
enable = true;
virtualHost = null;
pool = freshrss_pool;
user = "freshrss";
config = bridge_config;
};
}