Merge pull request #128141 from milogert/tt-rss-2021-06-21

tt-rss: 2021-01-29 -> 2021-06-23 and modules/tt-rss: updated config.php creation

authored by

Guillaume Girol and committed by
GitHub
0a505c36 9b0a99f6

+95 -62
+11
nixos/doc/manual/from_md/release-notes/rl-2111.section.xml
··· 572 572 </listitem> 573 573 <listitem> 574 574 <para> 575 + <literal>tt-rss</literal> was upgraded to the commit on 576 + 2021-06-21, which has breaking changes. If you use 577 + <literal>services.tt-rss.extraConfig</literal> you should 578 + migrate to the <literal>putenv</literal>-style configuration. 579 + See 580 + <link xlink:href="https://community.tt-rss.org/t/rip-config-php-hello-classes-config-php/4337">this 581 + Discourse post</link> in the tt-rss forums for more details. 582 + </para> 583 + </listitem> 584 + <listitem> 585 + <para> 575 586 The following Visual Studio Code extensions were renamed to 576 587 keep the naming convention uniform. 577 588 </para>
+2
nixos/doc/manual/release-notes/rl-2111.section.md
··· 146 146 147 147 - the `mingw-64` package has been upgraded from 6.0.0 to 9.0.0 148 148 149 + - `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. 150 + 149 151 - The following Visual Studio Code extensions were renamed to keep the naming convention uniform. 150 152 - `bbenoist.Nix` -> `bbenoist.nix` 151 153 - `CoenraadS.bracket-pair-colorizer` -> `coenraads.bracket-pair-colorizer`
+68 -59
nixos/modules/services/web-apps/tt-rss.nix
··· 19 19 mysqlLocal = cfg.database.createLocally && cfg.database.type == "mysql"; 20 20 pgsqlLocal = cfg.database.createLocally && cfg.database.type == "pgsql"; 21 21 22 - tt-rss-config = pkgs.writeText "config.php" '' 22 + tt-rss-config = let 23 + password = 24 + if (cfg.database.password != null) then 25 + "${(escape ["'" "\\"] cfg.database.password)}" 26 + else if (cfg.database.passwordFile != null) then 27 + "file_get_contents('${cfg.database.passwordFile}'" 28 + else 29 + "" 30 + ; 31 + in pkgs.writeText "config.php" '' 23 32 <?php 33 + putenv('TTRSS_PHP_EXECUTABLE=${pkgs.php}/bin/php'); 24 34 25 - define('PHP_EXECUTABLE', '${pkgs.php}/bin/php'); 26 - 27 - define('LOCK_DIRECTORY', '${lockDir}'); 28 - define('CACHE_DIR', '${cacheDir}'); 29 - define('ICONS_DIR', '${feedIconsDir}'); 30 - define('ICONS_URL', '${feedIconsDir}'); 31 - define('SELF_URL_PATH', '${cfg.selfUrlPath}'); 35 + putenv('TTRSS_LOCK_DIRECTORY=${lockDir}'); 36 + putenv('TTRSS_CACHE_DIR=${cacheDir}'); 37 + putenv('TTRSS_ICONS_DIR=${feedIconsDir}'); 38 + putenv('TTRSS_ICONS_URL=${feedIconsDir}'); 39 + putenv('TTRSS_SELF_URL_PATH=${cfg.selfUrlPath}'); 32 40 33 - define('MYSQL_CHARSET', 'UTF8'); 41 + putenv('TTRSS_MYSQL_CHARSET=UTF8'); 34 42 35 - define('DB_TYPE', '${cfg.database.type}'); 36 - define('DB_HOST', '${optionalString (cfg.database.host != null) cfg.database.host}'); 37 - define('DB_USER', '${cfg.database.user}'); 38 - define('DB_NAME', '${cfg.database.name}'); 39 - define('DB_PASS', ${ 40 - if (cfg.database.password != null) then 41 - "'${(escape ["'" "\\"] cfg.database.password)}'" 42 - else if (cfg.database.passwordFile != null) then 43 - "file_get_contents('${cfg.database.passwordFile}')" 44 - else 45 - "''" 46 - }); 47 - define('DB_PORT', '${toString dbPort}'); 43 + putenv('TTRSS_DB_TYPE=${cfg.database.type}'); 44 + putenv('TTRSS_DB_HOST=${optionalString (cfg.database.host != null) cfg.database.host}'); 45 + putenv('TTRSS_DB_USER=${cfg.database.user}'); 46 + putenv('TTRSS_DB_NAME=${cfg.database.name}'); 47 + putenv('TTRSS_DB_PASS=${password}'); 48 + putenv('TTRSS_DB_PORT=${toString dbPort}'); 48 49 49 - define('AUTH_AUTO_CREATE', ${boolToString cfg.auth.autoCreate}); 50 - define('AUTH_AUTO_LOGIN', ${boolToString cfg.auth.autoLogin}); 50 + putenv('TTRSS_AUTH_AUTO_CREATE=${boolToString cfg.auth.autoCreate}'); 51 + putenv('TTRSS_AUTH_AUTO_LOGIN=${boolToString cfg.auth.autoLogin}'); 51 52 52 - define('FEED_CRYPT_KEY', '${escape ["'" "\\"] cfg.feedCryptKey}'); 53 + putenv('TTRSS_FEED_CRYPT_KEY=${escape ["'" "\\"] cfg.feedCryptKey}'); 53 54 54 55 55 - define('SINGLE_USER_MODE', ${boolToString cfg.singleUserMode}); 56 + putenv('TTRSS_SINGLE_USER_MODE=${boolToString cfg.singleUserMode}'); 56 57 57 - define('SIMPLE_UPDATE_MODE', ${boolToString cfg.simpleUpdateMode}); 58 + putenv('TTRSS_SIMPLE_UPDATE_MODE=${boolToString cfg.simpleUpdateMode}'); 58 59 59 - // Never check for updates - the running version of the code should be 60 - // controlled entirely by the version of TT-RSS active in the current Nix 61 - // profile. If TT-RSS updates itself to a version requiring a database 62 - // schema upgrade, and then the SystemD tt-rss.service is restarted, the 63 - // old code copied from the Nix store will overwrite the updated version, 64 - // causing the code to detect the need for a schema "upgrade" (since the 65 - // schema version in the database is different than in the code), but the 66 - // update schema operation in TT-RSS will do nothing because the schema 67 - // version in the database is newer than that in the code. 68 - define('CHECK_FOR_UPDATES', false); 60 + # Never check for updates - the running version of the code should 61 + # be controlled entirely by the version of TT-RSS active in the 62 + # current Nix profile. If TT-RSS updates itself to a version 63 + # requiring a database schema upgrade, and then the SystemD 64 + # tt-rss.service is restarted, the old code copied from the Nix 65 + # store will overwrite the updated version, causing the code to 66 + # detect the need for a schema "upgrade" (since the schema version 67 + # in the database is different than in the code), but the update 68 + # schema operation in TT-RSS will do nothing because the schema 69 + # version in the database is newer than that in the code. 70 + putenv('TTRSS_CHECK_FOR_UPDATES=false'); 69 71 70 - define('FORCE_ARTICLE_PURGE', ${toString cfg.forceArticlePurge}); 71 - define('SESSION_COOKIE_LIFETIME', ${toString cfg.sessionCookieLifetime}); 72 - define('ENABLE_GZIP_OUTPUT', ${boolToString cfg.enableGZipOutput}); 72 + putenv('TTRSS_FORCE_ARTICLE_PURGE=${toString cfg.forceArticlePurge}'); 73 + putenv('TTRSS_SESSION_COOKIE_LIFETIME=${toString cfg.sessionCookieLifetime}'); 74 + putenv('TTRSS_ENABLE_GZIP_OUTPUT=${boolToString cfg.enableGZipOutput}'); 73 75 74 - define('PLUGINS', '${builtins.concatStringsSep "," cfg.plugins}'); 76 + putenv('TTRSS_PLUGINS=${builtins.concatStringsSep "," cfg.plugins}'); 75 77 76 - define('LOG_DESTINATION', '${cfg.logDestination}'); 77 - define('CONFIG_VERSION', ${toString configVersion}); 78 + putenv('TTRSS_LOG_DESTINATION=${cfg.logDestination}'); 79 + putenv('TTRSS_CONFIG_VERSION=${toString configVersion}'); 78 80 79 81 80 - define('PUBSUBHUBBUB_ENABLED', ${boolToString cfg.pubSubHubbub.enable}); 81 - define('PUBSUBHUBBUB_HUB', '${cfg.pubSubHubbub.hub}'); 82 + putenv('TTRSS_PUBSUBHUBBUB_ENABLED=${boolToString cfg.pubSubHubbub.enable}'); 83 + putenv('TTRSS_PUBSUBHUBBUB_HUB=${cfg.pubSubHubbub.hub}'); 82 84 83 - define('SPHINX_SERVER', '${cfg.sphinx.server}'); 84 - define('SPHINX_INDEX', '${builtins.concatStringsSep "," cfg.sphinx.index}'); 85 + putenv('TTRSS_SPHINX_SERVER=${cfg.sphinx.server}'); 86 + putenv('TTRSS_SPHINX_INDEX=${builtins.concatStringsSep "," cfg.sphinx.index}'); 85 87 86 - define('ENABLE_REGISTRATION', ${boolToString cfg.registration.enable}); 87 - define('REG_NOTIFY_ADDRESS', '${cfg.registration.notifyAddress}'); 88 - define('REG_MAX_USERS', ${toString cfg.registration.maxUsers}); 88 + putenv('TTRSS_ENABLE_REGISTRATION=${boolToString cfg.registration.enable}'); 89 + putenv('TTRSS_REG_NOTIFY_ADDRESS=${cfg.registration.notifyAddress}'); 90 + putenv('TTRSS_REG_MAX_USERS=${toString cfg.registration.maxUsers}'); 89 91 90 - define('SMTP_SERVER', '${cfg.email.server}'); 91 - define('SMTP_LOGIN', '${cfg.email.login}'); 92 - define('SMTP_PASSWORD', '${escape ["'" "\\"] cfg.email.password}'); 93 - define('SMTP_SECURE', '${cfg.email.security}'); 92 + putenv('TTRSS_SMTP_SERVER=${cfg.email.server}'); 93 + putenv('TTRSS_SMTP_LOGIN=${cfg.email.login}'); 94 + putenv('TTRSS_SMTP_PASSWORD=${escape ["'" "\\"] cfg.email.password}'); 95 + putenv('TTRSS_SMTP_SECURE=${cfg.email.security}'); 94 96 95 - define('SMTP_FROM_NAME', '${escape ["'" "\\"] cfg.email.fromName}'); 96 - define('SMTP_FROM_ADDRESS', '${escape ["'" "\\"] cfg.email.fromAddress}'); 97 - define('DIGEST_SUBJECT', '${escape ["'" "\\"] cfg.email.digestSubject}'); 97 + putenv('TTRSS_SMTP_FROM_NAME=${escape ["'" "\\"] cfg.email.fromName}'); 98 + putenv('TTRSS_SMTP_FROM_ADDRESS=${escape ["'" "\\"] cfg.email.fromAddress}'); 99 + putenv('TTRSS_DIGEST_SUBJECT=${escape ["'" "\\"] cfg.email.digestSubject}'); 98 100 99 101 ${cfg.extraConfig} 100 102 ''; ··· 564 566 "Z '${cfg.root}' 0755 ${cfg.user} tt_rss - -" 565 567 ]; 566 568 567 - systemd.services.tt-rss = 568 - { 569 + systemd.services = { 570 + phpfpm-tt-rss = mkIf (cfg.pool == "${poolName}") { 571 + restartTriggers = [ tt-rss-config pkgs.tt-rss ]; 572 + }; 569 573 574 + tt-rss = { 570 575 description = "Tiny Tiny RSS feeds update daemon"; 571 576 572 577 preStart = let ··· 604 609 ''} 605 610 ln -sf "${tt-rss-config}" "${cfg.root}/config.php" 606 611 chmod -R 755 "${cfg.root}" 612 + chmod -R ug+rwX "${cfg.root}/${lockDir}" 613 + chmod -R ug+rwX "${cfg.root}/${cacheDir}" 614 + chmod -R ug+rwX "${cfg.root}/${feedIconsDir}" 607 615 '' 608 616 609 617 + (optionalString (cfg.database.type == "pgsql") '' ··· 640 648 wantedBy = [ "multi-user.target" ]; 641 649 requires = optional mysqlLocal "mysql.service" ++ optional pgsqlLocal "postgresql.service"; 642 650 after = [ "network.target" ] ++ optional mysqlLocal "mysql.service" ++ optional pgsqlLocal "postgresql.service"; 651 + }; 643 652 }; 644 653 645 654 services.mysql = mkIf mysqlLocal {
+14 -3
pkgs/servers/tt-rss/default.nix
··· 2 2 3 3 stdenv.mkDerivation rec { 4 4 pname = "tt-rss"; 5 - version = "2021-01-29"; 6 - rev = "6d8f2221b82b6a31becbeed8baf5e05ad9e053fe"; 5 + year = "21"; 6 + month = "06"; 7 + day = "21"; 8 + version = "20${year}-${month}-${day}"; 9 + rev = "cd26dbe64c9b14418f0b2d826a38a35c6bf8a270"; 7 10 8 11 src = fetchurl { 9 12 url = "https://git.tt-rss.org/fox/tt-rss/archive/${rev}.tar.gz"; 10 - sha256 = "124c62hck631xlq5aa1miz9rbg711ygk7z1yx92m5dfcy630l7x5"; 13 + sha256 = "1dpmzi7hknv5rk2g1iw13r8zcxcwrhkd5hhf292ml0dw3cwki0gm"; 11 14 }; 12 15 13 16 installPhase = '' 17 + runHook preInstall 18 + 14 19 mkdir $out 15 20 cp -ra * $out/ 21 + 22 + # see the code of Config::get_version(). you can check that the version in 23 + # the footer of the preferences pages is not UNKNOWN 24 + echo "${year}.${month}" > $out/version_static.txt 25 + 26 + runHook postInstall 16 27 ''; 17 28 18 29 meta = with lib; {