nixos/freshrss: fix startup when authType = "none"

Prior to this patch, FreshRSS fails to load with an initial
`authType = "none"` setting, instead providing an error:
"Error during context user init!"

To fix this, this patch changes the freshrss-config service to
setup the initial `defaultUser` when `authType = "none"`
is configured.

+24 -4
+3 -3
nixos/modules/services/web-apps/freshrss.nix
··· 268 268 269 269 script = 270 270 let 271 - userScriptArgs = ''--user ${cfg.defaultUser} --password "$(cat ${cfg.passwordFile})"''; 272 - updateUserScript = optionalString (cfg.authType == "form") '' 271 + userScriptArgs = ''--user ${cfg.defaultUser} ${optionalString (cfg.authType == "form") ''--password "$(cat ${cfg.passwordFile})"''}''; 272 + updateUserScript = optionalString (cfg.authType == "form" || cfg.authType == "none") '' 273 273 ./cli/update-user.php ${userScriptArgs} 274 274 ''; 275 - createUserScript = optionalString (cfg.authType == "form") '' 275 + createUserScript = optionalString (cfg.authType == "form" || cfg.authType == "none") '' 276 276 ./cli/create-user.php ${userScriptArgs} 277 277 ''; 278 278 in
+1
nixos/tests/all-tests.nix
··· 328 328 freshrss-sqlite = handleTest ./freshrss-sqlite.nix {}; 329 329 freshrss-pgsql = handleTest ./freshrss-pgsql.nix {}; 330 330 freshrss-http-auth = handleTest ./freshrss-http-auth.nix {}; 331 + freshrss-none-auth = handleTest ./freshrss-none-auth.nix {}; 331 332 frigate = handleTest ./frigate.nix {}; 332 333 frp = handleTest ./frp.nix {}; 333 334 frr = handleTest ./frr.nix {};
+19
nixos/tests/freshrss-none-auth.nix
··· 1 + import ./make-test-python.nix ({ lib, pkgs, ... }: { 2 + name = "freshrss"; 3 + meta.maintainers = with lib.maintainers; [ mattchrist ]; 4 + 5 + nodes.machine = { pkgs, ... }: { 6 + services.freshrss = { 7 + enable = true; 8 + baseUrl = "http://localhost"; 9 + authType = "none"; 10 + }; 11 + }; 12 + 13 + testScript = '' 14 + machine.wait_for_unit("multi-user.target") 15 + machine.wait_for_open_port(80) 16 + response = machine.succeed("curl -vvv -s http://127.0.0.1:80/i/") 17 + assert '<title>Main stream · FreshRSS</title>' in response, "FreshRSS stream page didn't load successfully" 18 + ''; 19 + })
+1 -1
pkgs/servers/web-apps/freshrss/default.nix
··· 17 17 }; 18 18 19 19 passthru.tests = { 20 - inherit (nixosTests) freshrss-sqlite freshrss-pgsql freshrss-http-auth; 20 + inherit (nixosTests) freshrss-sqlite freshrss-pgsql freshrss-http-auth freshrss-none-auth; 21 21 }; 22 22 23 23 buildInputs = [ php ];