From b6868754e201d0c7e881ccc39a098b50fe819ff0 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Sun, 23 Feb 2025 17:19:55 +0000 Subject: [PATCH 1/3] cross-seed: 6.9.1->6.11.1 Also adds an update script --- pkgs/by-name/cr/cross-seed/package.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/cr/cross-seed/package.nix b/pkgs/by-name/cr/cross-seed/package.nix index b44b9e0ba8f46..2f328a72e2126 100644 --- a/pkgs/by-name/cr/cross-seed/package.nix +++ b/pkgs/by-name/cr/cross-seed/package.nix @@ -2,20 +2,23 @@ lib, buildNpmPackage, fetchFromGitHub, + nix-update-script, }: buildNpmPackage rec { pname = "cross-seed"; - version = "6.9.1"; + version = "6.11.1"; src = fetchFromGitHub { owner = "cross-seed"; repo = "cross-seed"; tag = "v${version}"; - hash = "sha256-BZ4uLPKSLtkERNUJ6PY2+djU8r8xM8vaXerfdGmYQq0="; + hash = "sha256-ZyagXbbYUZA2CfoqVh0pmKt91kTLUGB8hUItgHbPb2w="; }; - npmDepsHash = "sha256-hqQi0kSPm9SKEoLu6InvRMPxbQ+CBpKVPJhhOdo2ZII="; + npmDepsHash = "sha256-hSiGnw3Fo//oTONBmtuv0sDvldCzs1PsdImxdGWEpMo="; + + passthru.updateScript = nix-update-script; meta = { description = "Fully-automatic torrent cross-seeding with Torznab"; From 579bf01c3526b55e8e3f788081b584e29efef40e Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Sun, 23 Feb 2025 17:17:31 +0000 Subject: [PATCH 2/3] nixos/cross-seed: create outputDir --- nixos/modules/services/torrent/cross-seed.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/torrent/cross-seed.nix b/nixos/modules/services/torrent/cross-seed.nix index 61769fe6006a2..b860a0fff5508 100644 --- a/nixos/modules/services/torrent/cross-seed.nix +++ b/nixos/modules/services/torrent/cross-seed.nix @@ -154,9 +154,16 @@ in } ]; - systemd.tmpfiles.settings."10-cross-seed"."${cfg.configDir}".d = { - inherit (cfg) group user; - mode = "700"; + systemd.tmpfiles.settings."10-cross-seed" = { + ${cfg.configDir}.d = { + inherit (cfg) group user; + mode = "700"; + }; + + ${cfg.settings.outputDir}.d = { + inherit (cfg) group user; + mode = "750"; + }; }; systemd.services.cross-seed = { From 500a8bb9d58dc930a98dd9cd311d991c427c2f0b Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Sun, 23 Feb 2025 17:35:38 +0000 Subject: [PATCH 3/3] nixos/cross-seed: re-enable test --- nixos/tests/all-tests.nix | 1 + nixos/tests/cross-seed.nix | 43 ++++++++++++++++++++++++++ pkgs/by-name/cr/cross-seed/package.nix | 6 +++- 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/cross-seed.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 06b2b1179c46c..b1ca7bbcbcdf4 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -294,6 +294,7 @@ in { curl-impersonate = handleTest ./curl-impersonate.nix {}; custom-ca = handleTest ./custom-ca.nix {}; croc = handleTest ./croc.nix {}; + cross-seed = runTest ./cross-seed.nix; cyrus-imap = runTest ./cyrus-imap.nix; darling = handleTest ./darling.nix {}; darling-dmg = runTest ./darling-dmg.nix; diff --git a/nixos/tests/cross-seed.nix b/nixos/tests/cross-seed.nix new file mode 100644 index 0000000000000..c5721e7bc7b89 --- /dev/null +++ b/nixos/tests/cross-seed.nix @@ -0,0 +1,43 @@ +{ lib, ... }: +let + apiKey = "twentyfourcharacterskey!"; +in +{ + name = "cross-seed"; + meta.maintainers = with lib.maintainers; [ pta2002 ]; + + nodes.machine = + { pkgs, config, ... }: + let + cfg = config.services.cross-seed; + in + { + systemd.tmpfiles.settings."0-cross-seed-test"."${cfg.settings.torrentDir}".d = { + inherit (cfg) user group; + mode = "700"; + }; + + services.cross-seed = { + enable = true; + settings = { + torrentDir = "/var/lib/torrents"; + torznab = [ ]; + useClientTorrents = false; + }; + # # We create this secret in the Nix store (making it readable by everyone). + # # DO NOT DO THIS OUTSIDE OF TESTS!! + settingsFile = (pkgs.formats.json { }).generate "secrets.json" { + inherit apiKey; + }; + }; + }; + + testScript = # python + '' + start_all() + machine.wait_for_unit("cross-seed.service") + machine.wait_for_open_port(2468) + # Check that the API is running + machine.succeed("curl --fail http://localhost:2468/api/ping?apiKey=${apiKey}") + ''; +} diff --git a/pkgs/by-name/cr/cross-seed/package.nix b/pkgs/by-name/cr/cross-seed/package.nix index 2f328a72e2126..f5abb0347bf0d 100644 --- a/pkgs/by-name/cr/cross-seed/package.nix +++ b/pkgs/by-name/cr/cross-seed/package.nix @@ -3,6 +3,7 @@ buildNpmPackage, fetchFromGitHub, nix-update-script, + nixosTests, }: buildNpmPackage rec { @@ -18,7 +19,10 @@ buildNpmPackage rec { npmDepsHash = "sha256-hSiGnw3Fo//oTONBmtuv0sDvldCzs1PsdImxdGWEpMo="; - passthru.updateScript = nix-update-script; + passthru = { + updateScript = nix-update-script; + tests.cross-seed = nixosTests.cross-seed; + }; meta = { description = "Fully-automatic torrent cross-seeding with Torznab";