summary refs log tree commit diff
path: root/pkgs/tools/networking/p2p/rtorrent-jesec/default.nix
blob: eeff6e91399d67dea537597031967dd719690786 (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
{ lib
, stdenv
, fetchFromGitHub
, cmake
, gtest
, libtorrent-jesec
, curl
, ncurses
, xmlrpc_c
, nlohmann_json
, xmlRpcSupport ? true
, jsonRpcSupport ? true
}:
let
  inherit (lib) optional;
in
stdenv.mkDerivation rec {
  pname = "rtorrent-jesec";
  version = "0.9.8-r14";

  src = fetchFromGitHub {
    owner = "jesec";
    repo = "rtorrent";
    rev = "v${version}";
    sha256 = "sha256-AbjzNIha3MkCZi6MuyUfPx9r3zeXeTUzkbD7uHB85lo=";
  };

  nativeBuildInputs = [ cmake ];
  buildInputs = [ libtorrent-jesec curl ncurses ]
    ++ optional xmlRpcSupport xmlrpc_c
    ++ optional jsonRpcSupport nlohmann_json;

  cmakeFlags = [ "-DUSE_RUNTIME_CA_DETECTION=NO" ]
    ++ optional (!xmlRpcSupport) "-DUSE_XMLRPC=NO"
    ++ optional (!jsonRpcSupport) "-DUSE_JSONRPC=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; [ winterqt ];
    platforms = platforms.linux;
  };
}