summary refs log tree commit diff
path: root/pkgs/tools/networking/p2p/jesec-rtorrent/rtorrent.nix
blob: 7fe444228d374aac70f4d93ae347554b3eb85e6a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ lib
, stdenv
, fetchFromGitHub
, cmake
, curl
, gtest
, libtorrent
, ncurses
, jsonRpcSupport ? true, nlohmann_json
, xmlRpcSupport ? true, xmlrpc_c
}:

stdenv.mkDerivation rec {
  pname = "jesec-rtorrent";
  version = "0.9.8-r15";

  src = fetchFromGitHub {
    owner = "jesec";
    repo = "rtorrent";
    rev = "v${version}";
    hash = "sha256-yYOw8wsiQd478JijLgPtEWsw2/ewd46re+t9D705rmk=";
  };

  nativeBuildInputs = [
    cmake
  ];

  buildInputs = [
    curl
    libtorrent
    ncurses
  ]
  ++ lib.optional jsonRpcSupport nlohmann_json
  ++ lib.optional xmlRpcSupport xmlrpc_c;

  cmakeFlags = [
    "-DUSE_RUNTIME_CA_DETECTION=NO"
  ]
  ++ lib.optional (!jsonRpcSupport) "-DUSE_JSONRPC=NO"
  ++ lib.optional (!xmlRpcSupport) "-DUSE_XMLRPC=NO";


  doCheck = true;
  checkInputs = [
    gtest
  ];

  prePatch = ''
    substituteInPlace src/main.cc \
      --replace "/etc/rtorrent/rtorrent.rc" "${placeholder "out"}/etc/rtorrent/rtorrent.rc"
  '';

  postFixup = ''
    mkdir -p $out/etc/rtorrent
    cp $src/doc/rtorrent.rc $out/etc/rtorrent/rtorrent.rc
  '';

  meta = with lib; {
    description = "An ncurses client for libtorrent, ideal for use with screen, tmux, or dtach (jesec's fork)";
    homepage = "https://github.com/jesec/rtorrent";
    license = licenses.gpl2Plus;
    maintainers = with maintainers; [ winter AndersonTorres ];
    platforms = platforms.linux;
  };
}