summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/go/gobetween/package.nix
blob: cf09b66eab09f8d029c1abde9f5da074ca507b54 (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
{
  stdenv,
  buildGoModule,
  fetchFromGitHub,
  lib,
  enableStatic ? stdenv.hostPlatform.isStatic,
}:

buildGoModule (finalAttrs: {
  pname = "gobetween";
  version = "0.8.1";

  src = fetchFromGitHub {
    owner = "yyyar";
    repo = "gobetween";
    tag = finalAttrs.version;
    hash = "sha256-xmyqDi2q7J909cWMec9z2u0DJVJjzv86vjYkSfw/3o8=";
  };

  vendorHash = "sha256-3jv0dSsJg90J64Ay7USkUOi8cF1Sj+A7v/snJEdJPFU=";

  env = {
    CGO_ENABLED = 0;
  };

  buildPhase = ''
    runHook preBuild

    make -e build${lib.optionalString enableStatic "-static"}

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin
    cp bin/gobetween $out/bin
    cp -r share $out/share
    cp -r config $out/share

    runHook postInstall
  '';

  meta = {
    description = "Modern & minimalistic load balancer for the Cloud era";
    homepage = "https://gobetween.io";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ tomberek ];
    mainProgram = "gobetween";
  };
})