summary refs log tree commit diff
path: root/pkgs/servers/couchpotato/default.nix
blob: d276c02487df6e8f7bb858e0f7553d10d64669f8 (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
{ fetchFromGitHub, python2Packages, lib }:

with python2Packages;

buildPythonApplication rec {
  pname = "couchpotato";
  version = "3.0.1";
  disabled = isPy3k;

  src = fetchFromGitHub {
    owner = "CouchPotato";
    repo = "CouchPotatoServer";
    rev = "build/${version}";
    hash = "sha256-0k8MqLnqYjhHPE9/jncTFIj1T4F2aXU4mXdeEimDB7M=";
  };

  format = "other";

  postPatch = ''
    substituteInPlace CouchPotato.py --replace "dirname(os.path.abspath(__file__))" "os.path.join(dirname(os.path.abspath(__file__)), '../${python.sitePackages}')"
  '';

  installPhase = ''
    mkdir -p $out/bin/
    mkdir -p $out/${python.sitePackages}/

    cp -r libs/* $out/${python.sitePackages}/
    cp -r couchpotato $out/${python.sitePackages}/

    cp CouchPotato.py $out/bin/couchpotato
    chmod +x $out/bin/*
  '';

  postFixup = ''
    wrapProgram "$out/bin/couchpotato" --set PYTHONPATH "$PYTHONPATH:$out/${python.sitePackages}"
  '';

  meta = {
    description = "Automatic movie downloading via NZBs and torrents";
    license     = lib.licenses.gpl3;
    homepage    = "https://couchpota.to/";
    maintainers = with lib.maintainers; [ fadenb ];
  };
}