From bdb0bbef089df3b6b236aeef8ab9eb1212893160 Mon Sep 17 00:00:00 2001 From: Milo Gertjejansen Date: Fri, 25 Jun 2021 16:34:32 -0400 Subject: [PATCH 1/7] tt-rss: 2021-01-29 -> 2021-06-23 and modules/tt-rss: updated config.php creation The version of tt-rss in nixpkgs was pre-php 8. This updates tt-rss to the most recent version, which uses php 8. The updates to the module are required changes, per https://community.tt-rss.org/t/rip-config-php-hello-classes-config-php/4337. --- nixos/modules/services/web-apps/tt-rss.nix | 156 +++++++++++---------- pkgs/servers/tt-rss/default.nix | 6 +- 2 files changed, 85 insertions(+), 77 deletions(-) diff --git a/nixos/modules/services/web-apps/tt-rss.nix b/nixos/modules/services/web-apps/tt-rss.nix index b78487cc9281..b9feea7ffc5b 100644 --- a/nixos/modules/services/web-apps/tt-rss.nix +++ b/nixos/modules/services/web-apps/tt-rss.nix @@ -22,80 +22,6 @@ let tt-rss-config = pkgs.writeText "config.php" '' Date: Thu, 1 Jul 2021 15:38:04 -0400 Subject: [PATCH 2/7] Api didn't seem to work with the systemd envs I am not sure why it was working for me, but after restarting phpfpm-tt-rss it quit working. --- nixos/modules/services/web-apps/tt-rss.nix | 157 ++++++++++----------- 1 file changed, 77 insertions(+), 80 deletions(-) diff --git a/nixos/modules/services/web-apps/tt-rss.nix b/nixos/modules/services/web-apps/tt-rss.nix index b9feea7ffc5b..0b23ba56cabd 100644 --- a/nixos/modules/services/web-apps/tt-rss.nix +++ b/nixos/modules/services/web-apps/tt-rss.nix @@ -19,8 +19,84 @@ let mysqlLocal = cfg.database.createLocally && cfg.database.type == "mysql"; pgsqlLocal = cfg.database.createLocally && cfg.database.type == "pgsql"; - tt-rss-config = pkgs.writeText "config.php" '' + tt-rss-config = let + password = + if (cfg.database.password != null) then + "${(escape ["'" "\\"] cfg.database.password)}" + else if (cfg.database.passwordFile != null) then + "file_get_contents('${cfg.database.passwordFile}'" + else + "" + ; + in pkgs.writeText "config.php" '' Date: Fri, 25 Jun 2021 16:34:32 -0400 Subject: [PATCH 3/7] tt-rss: 2021-01-29 -> 2021-06-23 and modules/tt-rss: updated config.php creation The version of tt-rss in nixpkgs was pre-php 8. This updates tt-rss to the most recent version, which uses php 8. The updates to the module are required changes, per https://community.tt-rss.org/t/rip-config-php-hello-classes-config-php/4337. --- nixos/modules/services/web-apps/tt-rss.nix | 156 +++++++++++---------- pkgs/servers/tt-rss/default.nix | 6 +- 2 files changed, 85 insertions(+), 77 deletions(-) diff --git a/nixos/modules/services/web-apps/tt-rss.nix b/nixos/modules/services/web-apps/tt-rss.nix index b78487cc9281..b9feea7ffc5b 100644 --- a/nixos/modules/services/web-apps/tt-rss.nix +++ b/nixos/modules/services/web-apps/tt-rss.nix @@ -22,80 +22,6 @@ let tt-rss-config = pkgs.writeText "config.php" '' Date: Thu, 1 Jul 2021 15:38:04 -0400 Subject: [PATCH 4/7] Api didn't seem to work with the systemd envs I am not sure why it was working for me, but after restarting phpfpm-tt-rss it quit working. --- nixos/modules/services/web-apps/tt-rss.nix | 157 ++++++++++----------- 1 file changed, 77 insertions(+), 80 deletions(-) diff --git a/nixos/modules/services/web-apps/tt-rss.nix b/nixos/modules/services/web-apps/tt-rss.nix index b9feea7ffc5b..0b23ba56cabd 100644 --- a/nixos/modules/services/web-apps/tt-rss.nix +++ b/nixos/modules/services/web-apps/tt-rss.nix @@ -19,8 +19,84 @@ let mysqlLocal = cfg.database.createLocally && cfg.database.type == "mysql"; pgsqlLocal = cfg.database.createLocally && cfg.database.type == "pgsql"; - tt-rss-config = pkgs.writeText "config.php" '' + tt-rss-config = let + password = + if (cfg.database.password != null) then + "${(escape ["'" "\\"] cfg.database.password)}" + else if (cfg.database.passwordFile != null) then + "file_get_contents('${cfg.database.passwordFile}'" + else + "" + ; + in pkgs.writeText "config.php" '' Date: Sun, 25 Jul 2021 15:40:33 -0400 Subject: [PATCH 5/7] Added release notes and broke date apart --- .../from_md/release-notes/rl-2111.section.xml | 10 +++++++++- nixos/doc/manual/release-notes/rl-2111.section.md | 2 ++ nixos/modules/services/web-apps/tt-rss.nix | 10 ++++++++-- pkgs/servers/tt-rss/default.nix | 13 ++++++++++++- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml index a95b1dd66b96..c0e8867ca0e9 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml @@ -459,7 +459,7 @@ - + yggdrasil was upgraded to a new major @@ -468,6 +468,14 @@ changelog. + + + tt-rss was upgraded to the commit on + 2021-06-21, which has breaking changes, see + this + thread in the tt-rss forums for details. + +
diff --git a/nixos/doc/manual/release-notes/rl-2111.section.md b/nixos/doc/manual/release-notes/rl-2111.section.md index be46591dfa16..b0fbfc2bba70 100644 --- a/nixos/doc/manual/release-notes/rl-2111.section.md +++ b/nixos/doc/manual/release-notes/rl-2111.section.md @@ -115,6 +115,8 @@ In addition to numerous new and upgraded packages, this release has the followin - `yggdrasil` was upgraded to a new major release with breaking changes, see [upstream changelog](https://github.com/yggdrasil-network/yggdrasil-go/releases/tag/v0.4.0). +- `tt-rss` was upgraded to the commit on 2021-06-21, which has breaking changes, see [this thread](https://community.tt-rss.org/t/rip-config-php-hello-classes-config-php/4337) in the tt-rss forums for details. + ## Other Notable Changes {#sec-release-21.11-notable-changes} - The setting [`services.openssh.logLevel`](options.html#opt-services.openssh.logLevel) `"VERBOSE"` `"INFO"`. This brings NixOS in line with upstream and other Linux distributions, and reduces log spam on servers due to bruteforcing botnets. diff --git a/nixos/modules/services/web-apps/tt-rss.nix b/nixos/modules/services/web-apps/tt-rss.nix index 0b23ba56cabd..676683a557db 100644 --- a/nixos/modules/services/web-apps/tt-rss.nix +++ b/nixos/modules/services/web-apps/tt-rss.nix @@ -566,9 +566,14 @@ let "Z '${cfg.root}' 0755 ${cfg.user} tt_rss - -" ]; - systemd.services.tt-rss = - { + systemd.services = { + phpfpm-tt-rss = mkIf (cfg.pool == "${poolName}") { + restartTriggers = [ + cfg.root + ]; + }; + tt-rss = { description = "Tiny Tiny RSS feeds update daemon"; preStart = let @@ -645,6 +650,7 @@ let wantedBy = [ "multi-user.target" ]; requires = optional mysqlLocal "mysql.service" ++ optional pgsqlLocal "postgresql.service"; after = [ "network.target" ] ++ optional mysqlLocal "mysql.service" ++ optional pgsqlLocal "postgresql.service"; + }; }; services.mysql = mkIf mysqlLocal { diff --git a/pkgs/servers/tt-rss/default.nix b/pkgs/servers/tt-rss/default.nix index bd82f8d28905..39615a238e35 100644 --- a/pkgs/servers/tt-rss/default.nix +++ b/pkgs/servers/tt-rss/default.nix @@ -2,7 +2,10 @@ stdenv.mkDerivation rec { pname = "tt-rss"; - version = "2021-06-21"; + year = "21"; + month = "06"; + day = "21"; + version = "20${year}-${month}-${day}"; rev = "cd26dbe64c9b14418f0b2d826a38a35c6bf8a270"; src = fetchurl { @@ -11,8 +14,16 @@ stdenv.mkDerivation rec { }; installPhase = '' + runHook preInstall + mkdir $out cp -ra * $out/ + + # see the code of Config::get_version(). you can check that the version in + # the footer of the preferences pages is not UNKNOWN + echo "${year}.${month}" > $out/version_static.txt + + runHook postInstall ''; meta = with lib; { From 7aa2bf302ae563453b010cc27ea66affb055b26e Mon Sep 17 00:00:00 2001 From: Milo Gertjejansen Date: Wed, 28 Jul 2021 20:53:38 -0400 Subject: [PATCH 6/7] Added more detail to changelog, updated permissions in directory, and changed restartTriggers --- .../manual/from_md/release-notes/rl-2111.section.xml | 7 +++++-- nixos/doc/manual/release-notes/rl-2111.section.md | 2 +- nixos/modules/services/web-apps/tt-rss.nix | 10 ++++------ 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml index 31031a2d2e7b..c78c99cb6476 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2111.section.xml @@ -558,9 +558,12 @@ tt-rss was upgraded to the commit on - 2021-06-21, which has breaking changes, see + 2021-06-21, which has breaking changes. If you use + services.tt-rss.extraConfig you should + migrate to the putenv-style configuration. + See this - thread in the tt-rss forums for details. + Discourse post in the tt-rss forums for more details. diff --git a/nixos/doc/manual/release-notes/rl-2111.section.md b/nixos/doc/manual/release-notes/rl-2111.section.md index 5a6bf727c03a..eb45c9bf747d 100644 --- a/nixos/doc/manual/release-notes/rl-2111.section.md +++ b/nixos/doc/manual/release-notes/rl-2111.section.md @@ -142,7 +142,7 @@ pt-services.clipcat.enable). - the `mingw-64` package has been upgraded from 6.0.0 to 9.0.0 -- `tt-rss` was upgraded to the commit on 2021-06-21, which has breaking changes, see [this thread](https://community.tt-rss.org/t/rip-config-php-hello-classes-config-php/4337) in the tt-rss forums for details. +- `tt-rss` was upgraded to the commit on 2021-06-21, which has breaking changes. If you use `services.tt-rss.extraConfig` you should migrate to the `putenv`-style configuration. See [this Discourse post](https://community.tt-rss.org/t/rip-config-php-hello-classes-config-php/4337) in the tt-rss forums for more details. ## Other Notable Changes {#sec-release-21.11-notable-changes} diff --git a/nixos/modules/services/web-apps/tt-rss.nix b/nixos/modules/services/web-apps/tt-rss.nix index 676683a557db..7a6dc5f0a4ef 100644 --- a/nixos/modules/services/web-apps/tt-rss.nix +++ b/nixos/modules/services/web-apps/tt-rss.nix @@ -568,9 +568,7 @@ let systemd.services = { phpfpm-tt-rss = mkIf (cfg.pool == "${poolName}") { - restartTriggers = [ - cfg.root - ]; + restartTriggers = [ tt-rss-config tt-rss ]; }; tt-rss = { @@ -611,9 +609,9 @@ let ''} ln -sf "${tt-rss-config}" "${cfg.root}/config.php" chmod -R 755 "${cfg.root}" - chmod -R 777 "${cfg.root}/${lockDir}" - chmod -R 777 "${cfg.root}/${cacheDir}" - chmod -R 777 "${cfg.root}/${feedIconsDir}" + chmod -R ug+rwX "${cfg.root}/${lockDir}" + chmod -R ug+rwX "${cfg.root}/${cacheDir}" + chmod -R ug+rwX "${cfg.root}/${feedIconsDir}" '' + (optionalString (cfg.database.type == "pgsql") '' From 256af6b7422e99e7dba850718c0618905375c617 Mon Sep 17 00:00:00 2001 From: Guillaume Girol Date: Sat, 31 Jul 2021 15:19:00 +0000 Subject: [PATCH 7/7] nixos/tt-rss: fix eval --- nixos/modules/services/web-apps/tt-rss.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/web-apps/tt-rss.nix b/nixos/modules/services/web-apps/tt-rss.nix index 7a6dc5f0a4ef..ed13845915c4 100644 --- a/nixos/modules/services/web-apps/tt-rss.nix +++ b/nixos/modules/services/web-apps/tt-rss.nix @@ -568,7 +568,7 @@ let systemd.services = { phpfpm-tt-rss = mkIf (cfg.pool == "${poolName}") { - restartTriggers = [ tt-rss-config tt-rss ]; + restartTriggers = [ tt-rss-config pkgs.tt-rss ]; }; tt-rss = {