about summary refs log tree commit diff
path: root/pkgs/applications/networking/cluster/linkerd/generic.nix
diff options
context:
space:
mode:
authorsuperherointj <5861043+superherointj@users.noreply.github.com>2021-09-30 21:40:47 -0300
committersuperherointj <5861043+superherointj@users.noreply.github.com>2021-10-03 09:13:07 -0300
commitf6e0602096d78336dbd218878b5b98aaca005b20 (patch)
treed4b78c67f20e482b2a1e469a59ca27ed97c57e5c /pkgs/applications/networking/cluster/linkerd/generic.nix
parent0b24197f532a78d9c40209315bc134f55f5d9280 (diff)
linkerd: add updateScript
Diffstat (limited to 'pkgs/applications/networking/cluster/linkerd/generic.nix')
-rw-r--r--pkgs/applications/networking/cluster/linkerd/generic.nix59
1 files changed, 59 insertions, 0 deletions
diff --git a/pkgs/applications/networking/cluster/linkerd/generic.nix b/pkgs/applications/networking/cluster/linkerd/generic.nix
new file mode 100644
index 0000000000000..82172ebb9925a
--- /dev/null
+++ b/pkgs/applications/networking/cluster/linkerd/generic.nix
@@ -0,0 +1,59 @@
+{ lib, fetchFromGitHub, buildGoModule, installShellFiles }:
+
+{ channel, version, sha256, vendorSha256 }:
+
+buildGoModule rec {
+  pname = "linkerd-${channel}";
+  inherit version vendorSha256;
+
+  src = fetchFromGitHub {
+    owner = "linkerd";
+    repo = "linkerd2";
+    rev = "${channel}-${version}";
+    inherit sha256;
+  };
+
+  subPackages = [ "cli" ];
+  runVend = true;
+
+  preBuild = ''
+    env GOFLAGS="" go generate ./pkg/charts/static
+    env GOFLAGS="" go generate ./jaeger/static
+    env GOFLAGS="" go generate ./multicluster/static
+    env GOFLAGS="" go generate ./viz/static
+  '';
+
+  tags = [
+    "prod"
+  ];
+
+  ldflags = [
+    "-s" "-w"
+    "-X github.com/linkerd/linkerd2/pkg/version.Version=${src.rev}"
+  ];
+
+  nativeBuildInputs = [ installShellFiles ];
+
+  postInstall = ''
+    mv $out/bin/cli $out/bin/linkerd
+    installShellCompletion --cmd linkerd \
+      --bash <($out/bin/linkerd completion bash) \
+      --zsh <($out/bin/linkerd completion zsh) \
+      --fish <($out/bin/linkerd completion fish)
+  '';
+
+  doInstallCheck = true;
+  installCheckPhase = ''
+    $out/bin/linkerd version --client | grep ${src.rev} > /dev/null
+  '';
+
+  passthru.updateScript = (./. + "/update-${channel}.sh");
+
+  meta = with lib; {
+    description = "A simple Kubernetes service mesh that improves security, observability and reliability";
+    downloadPage = "https://github.com/linkerd/linkerd2/";
+    homepage = "https://linkerd.io/";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ Gonzih bryanasdev000 superherointj ];
+  };
+}