1{ stdenv, lib, go, fetchzip, git, fetchpatch, fetchFromGitHub, fetchgit }:
2
3# When perkeep is updated all deps in the let block should be removed
4let
5 gopherjs = fetchFromGitHub {
6 owner = "gopherjs";
7 repo = "gopherjs";
8 # Rev matching https://github.com/perkeep/perkeep/commit/2e46fca5cc1179dbd90bec49fec3870e6eca6c45
9 rev = "b40cd48c38f9a18eb3db20d163bad78de12cf0b7";
10 sha256 = "0kniz8dg5bymb03qriizza1h3gpymf97vsgq9vd222282pdj0vyc";
11 };
12
13 gotool = fetchFromGitHub {
14 owner = "kisielk";
15 repo = "gotool";
16 rev = "80517062f582ea3340cd4baf70e86d539ae7d84d";
17 sha256 = "14af2pa0ssyp8bp2mvdw184s5wcysk6akil3wzxmr05wwy951iwn";
18 };
19
20 gcimporter15 = fetchgit {
21 url = "https://go.googlesource.com/tools";
22 rev = "f8f2f88271bf2c23f28a09d288d26507a9503c97";
23 sha256 = "1pchwizx1sdli59g8r0p4djfjkchcvh8msfpp3ibvz3xl250jh0n";
24 };
25
26in
27stdenv.mkDerivation rec {
28 name = "perkeep-${version}";
29 version = "20170505";
30
31 src = fetchzip {
32 url = "https://perkeep.org/dl/monthly/camlistore-${version}-src.zip";
33 sha256 = "1vliyvkyzmhdi6knbh8rdsswmz3h0rpxdpq037jwbdbkjccxjdwa";
34 };
35
36 # When perkeep is updated postPatch should be removed
37 postPatch = ''
38 rm -r ./vendor/github.com/gopherjs/gopherjs/
39 cp -a ${gopherjs} ./vendor/github.com/gopherjs/gopherjs
40 mkdir -p ./vendor/github.com/kisielk/
41 cp -a ${gotool} ./vendor/github.com/kisielk/gotool
42 mkdir -p ./vendor/golang.org/x/tools/go
43 cp -a ${gcimporter15}/go/gcimporter15 ./vendor/golang.org/x/tools/go/gcimporter15
44
45 substituteInPlace vendor/github.com/gopherjs/gopherjs/build/build.go \
46 --replace '"github.com/fsnotify/fsnotify"' 'fsnotify "camlistore.org/pkg/misc/fakefsnotify"'
47
48 substituteInPlace ./make.go \
49 --replace "goVersionMinor = '8'" "goVersionMinor = '9'" \
50 --replace "gopherJSGoMinor = '8'" "gopherJSGoMinor = '9'"
51 '';
52
53 buildInputs = [ git go ];
54
55 goPackagePath = "";
56 buildPhase = ''
57 go run make.go
58 '';
59
60 installPhase = ''
61 mkdir -p $out/bin
62 cp bin/* $out/bin
63 '';
64
65 meta = with stdenv.lib; {
66 description = "A way of storing, syncing, sharing, modelling and backing up content (née Camlistore)";
67 homepage = https://perkeep.org;
68 license = licenses.asl20;
69 maintainers = with maintainers; [ cstrahan ];
70 platforms = platforms.unix;
71 };
72}