Commit 0c3f4b7d authored by Emily's avatar Emily
Browse files

{libtransmission_3,transmission_3{,-gtk,-qt,_noSystemd},torrential}: drop

Unmaintained upstream and it’s been a year since we started migrating
to Transmission 4. Let’s not carry networked software from half a
decade ago into 25.11.
parent 8b66d344
Loading
Loading
Loading
Loading
+29 −10
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ let
    optionalString
    optional
    mkDefault
    mkOptionDefault
    versionOlder
    escapeShellArgs
    optionalAttrs
    mkMerge
@@ -176,17 +178,12 @@ in
            };
            umask = mkOption {
              type = types.either types.int types.str;
              default = if cfg.package == pkgs.transmission_3 then 18 else "022";
              defaultText = literalExpression "if cfg.package == pkgs.transmission_3 then 18 else \"022\"";
              default = "022";
              description = ''
                Sets transmission's file mode creation mask.
                See the {manpage}`umask(2)` manpage for more information.
                Users who want their saved torrents to be world-writable
                may want to set this value to 0/`"000"`.

                Keep in mind, that if you are using Transmission 3, this has to
                be passed as a base 10 integer, whereas Transmission 4 takes
                an octal number in a string instead.
              '';
            };
            utp-enabled = mkOption {
@@ -222,9 +219,18 @@ in
        };
      };

      package = mkPackageOption pkgs "transmission" {
        default = "transmission_3";
      package =
        mkPackageOption pkgs "transmission" {
          default = "transmission_4";
          example = "pkgs.transmission_4";
        }
        // {
          defaultText = ''
            if lib.versionAtLeast config.system.stateVersion "25.11" then
              pkgs.transmission_4
            else
              «error message»
          '';
        };

      downloadDirPermissions = mkOption {
@@ -331,6 +337,19 @@ in
  };

  config = mkIf cfg.enable {
    services.transmission.package = mkIf (versionOlder config.system.stateVersion "25.11") (
      mkOptionDefault (throw ''
        `services.transmission.package` previously defaulted to
        `pkgs.transmission_3`, which has been removed in favour
        of `pkgs.transmission_4`.

        Please set `services.transmission.package` to
        `pkgs.transmission_4` explicitly. Note that upgrade
        caused data loss for some users so backup is recommended
        (see NixOS 24.11 release notes for details)
      '')
    );

    # Note that using systemd.tmpfiles would not work here
    # because it would fail when creating a directory
    # with a different owner than its parent directory, by saying:
+1 −2
Original line number Diff line number Diff line
@@ -1537,8 +1537,7 @@ in
  traefik = runTestOn [ "aarch64-linux" "x86_64-linux" ] ./traefik.nix;
  trafficserver = runTest ./trafficserver.nix;
  transfer-sh = runTest ./transfer-sh.nix;
  transmission_3 = handleTest ./transmission.nix { transmission = pkgs.transmission_3; };
  transmission_4 = handleTest ./transmission.nix { transmission = pkgs.transmission_4; };
  transmission_4 = handleTest ./transmission.nix { };
  trezord = runTest ./trezord.nix;
  trickster = runTest ./trickster.nix;
  trilium-server = runTestOn [ "x86_64-linux" ] ./trilium-server.nix;
+1 −2
Original line number Diff line number Diff line
import ./make-test-python.nix (
  { pkgs, transmission, ... }:
  { pkgs, ... }:
  {
    name = "transmission";
    meta = with pkgs.lib.maintainers; {
@@ -16,7 +16,6 @@ import ./make-test-python.nix (
        security.apparmor.enable = true;

        services.transmission.enable = true;
        services.transmission.package = transmission;
      };

    testScript = ''
+0 −86
Original line number Diff line number Diff line
{
  stdenv,
  lib,
  fetchFromGitHub,
  nix-update-script,
  desktop-file-utils,
  meson,
  ninja,
  pkg-config,
  python3,
  vala,
  wrapGAppsHook4,
  curl,
  dht,
  glib,
  gtk4,
  libb64,
  libevent,
  libgee,
  libnatpmp,
  libtransmission_3,
  libutp,
  miniupnpc,
  openssl,
  pantheon,
}:

stdenv.mkDerivation rec {
  pname = "torrential";
  version = "3.0.0";

  src = fetchFromGitHub {
    owner = "davidmhewitt";
    repo = "torrential";
    rev = version;
    sha256 = "sha256-uHc/VNtbhetmGyuhynZH1TvxJscVX17eWO6dzX6Ft3A=";
  };

  nativeBuildInputs = [
    desktop-file-utils
    meson
    ninja
    pkg-config
    python3
    vala
    wrapGAppsHook4
  ];

  buildInputs = [
    curl
    dht
    glib
    gtk4
    libb64
    libevent
    libgee
    libnatpmp
    libtransmission_3
    libutp
    miniupnpc
    openssl
    pantheon.granite7
  ];

  postPatch = ''
    chmod +x meson/post_install.py
    patchShebangs meson/post_install.py

    substituteInPlace meson/post_install.py \
      --replace "gtk-update-icon-cache" "gtk4-update-icon-cache"
  '';

  passthru = {
    updateScript = nix-update-script { };
  };

  meta = with lib; {
    description = "Download torrents in style with this speedy, minimalist torrent client for elementary OS";
    homepage = "https://github.com/davidmhewitt/torrential";
    maintainers = with maintainers; [ xiorcale ];
    teams = [ teams.pantheon ];
    platforms = platforms.linux;
    license = licenses.gpl2Plus;
    mainProgram = "com.github.davidmhewitt.torrential";
  };
}
+0 −183
Original line number Diff line number Diff line
{
  stdenv,
  lib,
  fetchFromGitHub,
  cmake,
  pkg-config,
  openssl,
  curl,
  libevent,
  inotify-tools,
  systemd,
  zlib,
  pcre,
  libb64,
  libutp,
  miniupnpc,
  dht,
  libnatpmp,
  libiconv,
  # Build options
  enableGTK3 ? false,
  gtk3,
  xorg,
  wrapGAppsHook3,
  enableQt ? false,
  qt5,
  nixosTests,
  enableSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd,
  enableDaemon ? true,
  enableCli ? true,
  installLib ? false,
  apparmorRulesFromClosure,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "transmission";
  version = "3.00";

  src = fetchFromGitHub {
    owner = "transmission";
    repo = "transmission";
    tag = finalAttrs.version;
    hash = "sha256-n4iEDt9AstDZPZXN47p13brNLbNWS3BTB+A4UuoEjzE=";
    fetchSubmodules = true;
  };

  patches = [
    # fix build with openssl 3.0
    ./transmission-3.00-openssl-3.patch
    # fix build with miniupnpc 2.2.8
    ./transmission-3.00-miniupnpc-2.2.8.patch
  ];

  # Compatibility with CMake < 3.5 has been removed from CMake.
  postPatch = ''
    substituteInPlace \
      CMakeLists.txt \
      --replace-fail \
        "cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)" \
        "cmake_minimum_required(VERSION 3.5)"
  '';

  outputs = [
    "out"
    "apparmor"
  ];

  cmakeFlags =
    let
      mkFlag = opt: if opt then "ON" else "OFF";
    in
    [
      "-DENABLE_MAC=OFF" # requires xcodebuild
      "-DENABLE_GTK=${mkFlag enableGTK3}"
      "-DENABLE_QT=${mkFlag enableQt}"
      "-DENABLE_DAEMON=${mkFlag enableDaemon}"
      "-DENABLE_CLI=${mkFlag enableCli}"
      "-DINSTALL_LIB=${mkFlag installLib}"
    ];

  nativeBuildInputs = [
    pkg-config
    cmake
  ]
  ++ lib.optionals enableGTK3 [ wrapGAppsHook3 ]
  ++ lib.optionals enableQt [ qt5.wrapQtAppsHook ];

  buildInputs = [
    openssl
    curl
    libevent
    zlib
    pcre
    libb64
    libutp
    miniupnpc
    dht
    libnatpmp
  ]
  ++ lib.optionals enableQt [
    qt5.qttools
    qt5.qtbase
  ]
  ++ lib.optionals enableGTK3 [
    gtk3
    xorg.libpthreadstubs
  ]
  ++ lib.optionals enableSystemd [ systemd ]
  ++ lib.optionals stdenv.hostPlatform.isLinux [ inotify-tools ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];

  postInstall = ''
    mkdir $apparmor
    cat >$apparmor/bin.transmission-daemon <<EOF
    include <tunables/global>
    $out/bin/transmission-daemon {
      include <abstractions/base>
      include <abstractions/nameservice>
      include <abstractions/ssl_certs>
      include "${
        apparmorRulesFromClosure { name = "transmission-daemon"; } (
          [
            curl
            libevent
            openssl
            pcre
            zlib
            libnatpmp
            miniupnpc
          ]
          ++ lib.optionals enableSystemd [ systemd ]
          ++ lib.optionals stdenv.hostPlatform.isLinux [ inotify-tools ]
        )
      }"
      r @{PROC}/sys/kernel/random/uuid,
      r @{PROC}/sys/vm/overcommit_memory,
      r @{PROC}/@{pid}/environ,
      r @{PROC}/@{pid}/mounts,
      rwk /tmp/tr_session_id_*,

      r $out/share/transmission/web/**,

      include <local/bin.transmission-daemon>
    }
    EOF
  '';

  env = {
    # Fix GCC 14 build
    NIX_CFLAGS_COMPILE = "-Wno-error=incompatible-pointer-types";
  };

  passthru.tests = {
    apparmor = nixosTests.transmission_3; # starts the service with apparmor enabled
    smoke-test = nixosTests.bittorrent;
  };

  meta = {
    description = "Fast, easy and free BitTorrent client (deprecated version 3)";
    mainProgram =
      if enableQt then
        "transmission-qt"
      else if enableGTK3 then
        "transmission-gtk"
      else
        "transmission-cli";
    longDescription = ''
      Transmission is a BitTorrent client which features a simple interface
      on top of a cross-platform back-end.
      Feature spotlight:
        * Uses fewer resources than other clients
        * Native Mac, GTK and Qt GUI clients
        * Daemon ideal for servers, embedded systems, and headless use
        * All these can be remote controlled by Web and Terminal clients
        * Bluetack (PeerGuardian) blocklists with automatic updates
        * Full encryption, DHT, and PEX support
    '';
    homepage = "http://www.transmissionbt.com/";
    license = lib.licenses.gpl2Plus; # parts are under MIT
    platforms = lib.platforms.unix;
  };

})
Loading