fix freshrss

This commit is contained in:
2023-11-07 15:06:51 +08:00
parent 90a3604ac7
commit 35c183f9dc
2 changed files with 50 additions and 3 deletions

View File

@@ -22,6 +22,7 @@ inputs:
type = "mysql";
passFile = inputs.config.sops.secrets."freshrss/db".path;
};
virtualHost = null;
};
sops.secrets =
{
@@ -32,7 +33,29 @@ inputs:
key = "mariadb/freshrss";
};
};
nixos.services.mariadb = { enable = true; instances.freshrss = {}; };
systemd.services.freshrss-config.after = [ "mysql.service" ];
nixos.services =
{
mariadb = { enable = true; instances.freshrss = {}; };
nginx.http.${freshrss.hostname} =
{
rewriteHttps = true;
locations =
{
"/".static =
{
root = "${inputs.pkgs.freshrss}/p";
index = [ "index.php" ];
tryFiles = [ "$uri" "$uri/" "$uri/index.php" ];
};
"~ ^.+?\.php(/.*)?$".php =
{
root = "${inputs.pkgs.freshrss}/p";
fastcgiPass =
"unix:${inputs.config.services.phpfpm.pools.${inputs.config.services.freshrss.pool}.socket}";
};
};
};
};
};
}

View File

@@ -41,7 +41,17 @@ inputs:
type = types.nullOr (types.submodule { options =
{
root = mkOption { type = types.nonEmptyStr; };
index = mkOption { type = types.nonEmptyStr; default = "index.html"; };
index = mkOption { type = types.listOf types.nonEmptyStr; default = [ "index.html" ]; };
tryFiles = mkOption { type = types.listOf types.nonEmptyStr; default = []; };
};});
default = null;
};
php = mkOption
{
type = types.nullOr (types.submodule { options =
{
root = mkOption { type = types.nonEmptyStr; };
fastcgiPass = mkOption { type = types.nonEmptyStr; };
};});
default = null;
};
@@ -143,7 +153,21 @@ inputs:
else if (location.value.static != null) then
{
root = location.value.static.root;
index = location.value.static.index;
index = mkIf (location.value.static.index != [])
(concatStringsSep " " location.value.static.index);
tryFiles = mkIf (location.value.static.tryFiles != [])
(concatStringsSep " " location.value.static.tryFiles);
}
else if (location.value.php != null) then
{
root = location.value.php.root;
extraConfig =
''
fastcgi_pass ${location.value.php.fastcgiPass};
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
include ${inputs.config.services.nginx.package}/conf/fastcgi.conf;
'';
}
else {};
})