Unverified Commit 9a5de3bb authored by Kevin Cox's avatar Kevin Cox Committed by GitHub
Browse files

nixos/cross-seed: create outputDir on start and re-enable test (#384570)

parents 206c012f 500a8bb9
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -154,11 +154,18 @@ in
        }
      ];

      systemd.tmpfiles.settings."10-cross-seed"."${cfg.configDir}".d = {
      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 = {
        description = "cross-seed";
        after = [ "network-online.target" ];
+1 −0
Original line number Diff line number Diff line
@@ -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;
+43 −0
Original line number Diff line number Diff line
{ 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}")
    '';
}
+10 −3
Original line number Diff line number Diff line
@@ -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";