about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/perkeep/default.nix
blob: 2b14079ae609f6e45cc2e2b7f5564121c49f1fed (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
{ buildGoModule, fetchurl, fetchFromGitHub, lib }:

let
  gouiJS = fetchurl {
    url = "https://storage.googleapis.com/perkeep-release/gopherjs/goui.js";
    sha256 = "0xbkdpd900gnmzj8p0x38dn4sv170pdvgzcvzsq70s80p6ykkh6g";
  };

  publisherJS = fetchurl {
    url = "https://storage.googleapis.com/perkeep-release/gopherjs/publisher.js";
    sha256 = "09hd7p0xscqnh612jbrjvh3njmlm4292zd5sbqx2lg0aw688q8p2";
  };

  packages = [
    "perkeep.org/server/perkeepd"
    "perkeep.org/cmd/pk"
    "perkeep.org/cmd/pk-get"
    "perkeep.org/cmd/pk-put"
    "perkeep.org/cmd/pk-mount"
  ];

in buildGoModule rec {
  pname = "perkeep";
  version = "0.11";

  src = fetchFromGitHub {
    owner = "perkeep";
    repo = "perkeep";
    rev = version;
    sha256 = "07j5gplk4kcrbazyg4m4bwggzlz5gk89h90r14jvfcpms7v5nrll";
  };

  vendorSha256 = "1af9a6r9qfrak0n5xyv9z8n7gn7xw2sdjn4s9bwwidkrdm81iq6b";
  deleteVendor = true; # Vendor is out of sync with go.mod

  buildPhase = ''
    cd "$NIX_BUILD_TOP/source"

    # Skip network fetches
    cp ${publisherJS} app/publisher/publisher.js
    cp ${gouiJS} server/perkeepd/ui/goui.js

    go run make.go -offline=true -targets=${lib.concatStringsSep "," packages}
  '';

  # genfileembed gets built regardless of -targets, to embed static
  # content into the Perkeep binaries. Remove it in post-install to
  # avoid polluting paths.
  postInstall = ''
    rm -f $out/bin/genfileembed
  '';

  meta = with lib; {
    description = "A way of storing, syncing, sharing, modelling and backing up content (née Camlistore)";
    homepage = "https://perkeep.org";
    license = licenses.asl20;
    maintainers = with maintainers; [ cstrahan danderson kalbasit ];
  };
}