commit e5049e059611531bb078866b9bd19070e398aa57
parent f2529324d8655fa498c4133e40beee6217ca7bb3
Author: Vincent Demeester <vincent@sbr.pm>
Date: Fri, 23 Jul 2021 10:49:53 +0200
nix/packages: add kam v1.1.1
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Diffstat:
3 files changed, 56 insertions(+), 0 deletions(-)
diff --git a/flake.nix b/flake.nix
@@ -393,6 +393,11 @@
buildkit = pkgs.callPackage ./nix/packages/buildkit { };
} // optionalAttrs (system == "x86_64-linux") {
# OpenShift
+
+ inherit (pkgs.callPackage ./nix/packages/kam { })
+ kam_1_1
+ kam
+ ;
inherit (pkgs.callPackage ./nix/packages/oc { })
oc_4_1
oc_4_2
diff --git a/nix/packages/default.nix b/nix/packages/default.nix
@@ -88,6 +88,11 @@ rec {
openshift-install
;
+ inherit (pkgs.callPackage ./kam { })
+ kam_1_1
+ kam
+ ;
+
inherit (pkgs.callPackage ./crc { oc_4_4 = oc_4_4; oc_4_3 = oc_4_3; })
crc_1_9
crc_1_10
diff --git a/nix/packages/kam/default.nix b/nix/packages/kam/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, lib, fetchurl }:
+
+with lib;
+rec {
+ kamGen =
+ { version
+ , sha256
+ }:
+
+ stdenv.mkDerivation rec {
+ pname = "kam";
+ name = "${pname}-${version}";
+
+ src = fetchurl {
+ url = "https://mirror.openshift.com/pub/openshift-v4/clients/kam/v${version}/kam-linux-amd64.tar.gz";
+ sha256 = "${sha256}";
+ };
+
+ phases = " unpackPhase installPhase fixupPhase ";
+
+ unpackPhase = ''
+ runHook preUnpack
+ mkdir ${name}
+ tar -C ${name} -xzf $src
+ '';
+
+ installPhase = ''
+ runHook preInstall
+ install -D ${name}/kam $out/bin/kam
+ patchelf \
+ --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
+ $out/bin/kam
+ # completions
+ mkdir -p $out/share/bash-completion/completions/
+ $out/bin/kam completion bash > $out/share/bash-completion/completions/kam
+ mkdir -p $out/share/zsh/site-functions
+ $out/bin/kam completion zsh > $out/share/zsh/site-functions/_kam
+ '';
+ };
+
+ kam = kam_1_1;
+ kam_1_1 = makeOverridable kamGen {
+ version = "1.1.1";
+ sha256 = "0cxf2n6y9arabq4ri3ni8v17vaflg9xqycmjwv2cm13bj4d7a1nq";
+ };
+}