mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
tt-rss service: Allow setting application root
This commit is contained in:
parent
c82d9e9fae
commit
bc9c9dd6bd
1 changed files with 17 additions and 10 deletions
|
@ -91,6 +91,15 @@ let
|
||||||
|
|
||||||
enable = mkEnableOption "tt-rss";
|
enable = mkEnableOption "tt-rss";
|
||||||
|
|
||||||
|
root = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = "/var/lib/tt-rss";
|
||||||
|
example = "/var/lib/tt-rss";
|
||||||
|
description = ''
|
||||||
|
Root of the application.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
user = mkOption {
|
user = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "nginx";
|
default = "nginx";
|
||||||
|
@ -445,9 +454,7 @@ let
|
||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = let
|
config = mkIf cfg.enable {
|
||||||
root = "/var/lib/tt-rss";
|
|
||||||
in mkIf cfg.enable {
|
|
||||||
|
|
||||||
services.phpfpm.poolConfigs = if cfg.pool == "${poolName}" then {
|
services.phpfpm.poolConfigs = if cfg.pool == "${poolName}" then {
|
||||||
"${poolName}" = ''
|
"${poolName}" = ''
|
||||||
|
@ -524,12 +531,12 @@ let
|
||||||
else "";
|
else "";
|
||||||
|
|
||||||
in ''
|
in ''
|
||||||
rm -rf "${root}/*"
|
rm -rf "${cfg.root}/*"
|
||||||
mkdir -m 755 -p "${root}"
|
mkdir -m 755 -p "${cfg.root}"
|
||||||
cp -r "${pkgs.tt-rss}/"* "${root}"
|
cp -r "${pkgs.tt-rss}/"* "${cfg.root}"
|
||||||
ln -sf "${tt-rss-config}" "${root}/config.php"
|
ln -sf "${tt-rss-config}" "${cfg.root}/config.php"
|
||||||
chown -R "${cfg.user}" "${root}"
|
chown -R "${cfg.user}" "${cfg.root}"
|
||||||
chmod -R 755 "${root}"
|
chmod -R 755 "${cfg.root}"
|
||||||
'' + (optionalString (cfg.database.type == "pgsql") ''
|
'' + (optionalString (cfg.database.type == "pgsql") ''
|
||||||
|
|
||||||
exists=$(${callSql "select count(*) > 0 from pg_tables where tableowner = user"} \
|
exists=$(${callSql "select count(*) > 0 from pg_tables where tableowner = user"} \
|
||||||
|
@ -554,7 +561,7 @@ let
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = "${cfg.user}";
|
User = "${cfg.user}";
|
||||||
ExecStart = "${pkgs.php}/bin/php /var/lib/tt-rss/update.php --daemon";
|
ExecStart = "${pkgs.php}/bin/php ${cfg.root}/update.php --daemon";
|
||||||
StandardOutput = "syslog";
|
StandardOutput = "syslog";
|
||||||
StandardError = "syslog";
|
StandardError = "syslog";
|
||||||
PermissionsStartOnly = true;
|
PermissionsStartOnly = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue