about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/cluster/k3sup/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/networking/cluster/k3sup/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/networking/cluster/k3sup/default.nix54
1 files changed, 54 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/networking/cluster/k3sup/default.nix b/nixpkgs/pkgs/applications/networking/cluster/k3sup/default.nix
new file mode 100644
index 000000000000..c45970ddeef8
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/cluster/k3sup/default.nix
@@ -0,0 +1,54 @@
+{ lib
+, buildGoModule
+, fetchFromGitHub
+, makeWrapper
+, installShellFiles
+, bash
+, openssh
+}:
+
+buildGoModule rec {
+  pname = "k3sup";
+  version = "0.13.0";
+
+  src = fetchFromGitHub {
+    owner = "alexellis";
+    repo = "k3sup";
+    rev = version;
+    sha256 = "sha256-GppNYNqX/YqRtCYQIe3t2x6eNJCZc/yi6F2xHvA3YXE=";
+  };
+
+  nativeBuildInputs = [ makeWrapper installShellFiles ];
+
+  vendorHash = null;
+
+  postConfigure = ''
+    substituteInPlace vendor/github.com/alexellis/go-execute/pkg/v1/exec.go \
+      --replace "/bin/bash" "${bash}/bin/bash"
+  '';
+
+  CGO_ENABLED = 0;
+
+  ldflags = [
+    "-s" "-w"
+    "-X github.com/alexellis/k3sup/cmd.GitCommit=ref/tags/${version}"
+    "-X github.com/alexellis/k3sup/cmd.Version=${version}"
+  ];
+
+  postInstall = ''
+    wrapProgram "$out/bin/k3sup" \
+      --prefix PATH : ${lib.makeBinPath [ openssh ]}
+
+    installShellCompletion --cmd k3sup \
+      --bash <($out/bin/k3sup completion bash) \
+      --zsh <($out/bin/k3sup completion zsh) \
+      --fish <($out/bin/k3sup completion fish)
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/alexellis/k3sup";
+    description = "Bootstrap Kubernetes with k3s over SSH";
+    license = licenses.mit;
+    maintainers = with maintainers; [ welteki qjoly ];
+  };
+}