Skip to content

Commit

Permalink
nixos/cross-seed: create outputDir on start and re-enable test (#384570)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincox authored Feb 23, 2025
2 parents 206c012 + 500a8bb commit 9a5de3b
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 6 deletions.
13 changes: 10 additions & 3 deletions nixos/modules/services/torrent/cross-seed.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
1 change: 1 addition & 0 deletions nixos/tests/all-tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
43 changes: 43 additions & 0 deletions nixos/tests/cross-seed.nix
Original file line number Diff line number Diff line change
@@ -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}")
'';
}
13 changes: 10 additions & 3 deletions pkgs/by-name/cr/cross-seed/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,27 @@
lib,
buildNpmPackage,
fetchFromGitHub,
nix-update-script,
nixosTests,
}:

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;
tests.cross-seed = nixosTests.cross-seed;
};

meta = {
description = "Fully-automatic torrent cross-seeding with Torznab";
Expand Down

0 comments on commit 9a5de3b

Please sign in to comment.