aboutsummaryrefslogtreecommitdiff
path: root/pkgs/impure/peertube/default.nix
blob: 89fcb043326172767d32ce1cde3e3c2790833648 (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
{ stdenv, fetchzip, cacert, mylibs, python, git, yarn, nodejs }:
let
  # Doesn't seem to work
  # patchedPackages = stdenv.mkDerivation (fetchedGithub ./peertube.json // rec {
  #   patches = [ ./ldap.patch ];
  #   installPhase = ''
  #     mkdir $out
  #     cp package.json yarn.lock $out/
  #     '';
  # });
  # yarnModules = pkgs.yarn2nix.mkYarnModules {
  #   name = "peertube-yarn-modules";
  #   packageJSON = "${patchedPackages}/package.json";
  #   yarnLock = "${patchedPackages}/yarn.lock";
  #   yarnNix = ./yarn-packages.nix;
  # };
  patchedServer = stdenv.mkDerivation (mylibs.fetchedGithub ./peertube.json // rec {
    __noChroot = true;
    patches = [
      ./ldap.patch
      ./sendmail.patch
    ];
    buildPhase = ''
      export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
      export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
      export HOME=$PWD
      yarn install --pure-lockfile
      npm run build:server
      '';
    installPhase = ''
      mkdir $out
      cp -a dist/server $out
      '';
    buildInputs = [ python git yarn nodejs ];
  });
in
stdenv.mkDerivation rec {
  __noChroot = true;
  version = "v1.2.0";
  name = "peertube-${version}";
  src = fetchzip {
    url = "https://github.com/Chocobozzz/PeerTube/releases/download/${version}/${name}.zip";
    sha256 = "18fp3fy1crw67gdpc29nr38b5zy2f68l70w47zwp7dzhd8bbbipp";
  };
  patches = [ ./ldap_yarn.patch ];
  buildPhase = ''
    export GIT_SSL_CAINFO=${cacert}/etc/ssl/certs/ca-bundle.crt
    export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
    export HOME=$PWD
    yarn install --production --pure-lockfile
    rm -rf dist/server && cp -a ${patchedServer}/server dist
    '';
  installPhase = ''
    mkdir $out
    cp -a * $out
    '';
  buildInputs = [ yarn git python ];
}