summaryrefslogtreecommitdiffstats
path: root/pkgs/applications/networking/bee/bee-clef.nix
blob: a94386ea3f1198d9ccbea6123e016d10d563d4b1 (plain)
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
{ version ? "release", stdenv, lib, substituteAll, fetchFromGitHub, go-ethereum }:

stdenv.mkDerivation rec {
  pname = "bee-clef";
  version = "0.4.7";

  src = fetchFromGitHub {
    owner = "ethersphere";
    repo = "bee-clef";
    rev = "refs/tags/v${version}";
    sha256 = "1sfwql0kvnir8b9ggpqcyc0ar995gxgfbhqb1xpfzp6wl0g3g4zz";
  };

  buildInputs = [ go-ethereum ];

  clefBinary = "${go-ethereum}/bin/clef";

  patches = [
    ./0001-clef-service-accept-default-CONFIGDIR-from-the-envir.patch
    ./0002-nix-diff-for-substituteAll.patch
  ];

  dontBuild = true;

  installPhase = ''
    mkdir -p $out/bin/
    mkdir -p $out/share/bee-clef/
    mkdir -p $out/lib/systemd/system/
    cp packaging/bee-clef.service $out/lib/systemd/system/
    substituteAll packaging/bee-clef-service $out/share/bee-clef/bee-clef-service
    substituteAll ${./ensure-clef-account} $out/share/bee-clef/ensure-clef-account
    substituteAll packaging/bee-clef-keys $out/bin/bee-clef-keys
    cp packaging/rules.js packaging/4byte.json $out/share/bee-clef/
    chmod +x $out/bin/bee-clef-keys
    chmod +x $out/share/bee-clef/bee-clef-service
    chmod +x $out/share/bee-clef/ensure-clef-account
    patchShebangs $out/
  '';

  meta = with lib; {
    # homepage = "https://gateway.ethswarm.org/bzz/docs.swarm.eth/docs/installation/bee-clef/";
    homepage = "https://docs.ethswarm.org/docs/installation/bee-clef";
    description = "External signer for Ethereum Swarm Bee";
    longDescription = ''
      clef is go-ethereum's external signer.

      bee-clef is a package that starts up a vanilla clef instance as a systemd service,
      but configured in such a way that is suitable for bee (relaxed security for
      automated operation).

      This package contains the files necessary to run the bee-clef service.
    '';
    license = with licenses; [ bsd3 ];
    maintainers = with maintainers; [ attila-lendvai ];
    platforms = go-ethereum.meta.platforms;
  };
}