oc.nix (2120B)
1 { stdenv, lib, fetchurl }: 2 3 with lib; 4 rec { 5 ocGen = 6 { version 7 , sha256 8 }: 9 10 stdenv.mkDerivation rec { 11 pname = "oc"; 12 name = "${pname}-${version}"; 13 14 src = fetchurl { 15 url = "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/${version}/openshift-client-linux-${version}.tar.gz"; 16 sha256 = "${sha256}"; 17 }; 18 19 phases = " unpackPhase installPhase fixupPhase "; 20 21 unpackPhase = '' 22 runHook preUnpack 23 mkdir ${name} 24 tar -C ${name} -xzf $src 25 ''; 26 27 installPhase = '' 28 runHook preInstall 29 install -D ${name}/oc $out/bin/oc 30 patchelf \ 31 --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \ 32 $out/bin/oc 33 # completions 34 mkdir -p $out/share/bash-completion/completions/ 35 $out/bin/oc completion bash > $out/share/bash-completion/completions/oc 36 mkdir -p $out/share/zsh/site-functions 37 $out/bin/oc completion zsh > $out/share/zsh/site-functions/_oc 38 ''; 39 }; 40 41 oc = oc_4_8; 42 oc_4_8 = makeOverridable ocGen { 43 version = "4.8.14"; 44 sha256 = "14685hgipbrzymjfgh2aa2y47l67vw018sdvmd140xcp3syp2y4l"; 45 }; 46 oc_4_7 = makeOverridable ocGen { 47 version = "4.7.33"; 48 sha256 = "1253rpbcls6xd6hzss8wwgphw7w4sc4x3pvy8vrzzpzl7g99zvcx"; 49 }; 50 oc_4_6 = makeOverridable ocGen { 51 version = "4.6.47"; 52 sha256 = "0gipr5wlblwcc53lm97l4pq14fs93b9hi1jg1kc68bh1ivpbfil7"; 53 }; 54 oc_4_5 = makeOverridable ocGen { 55 version = "4.5.41"; 56 sha256 = "01m7iak83md7y1nfdywizr5sxk3kd8543ahzqh2ncj9sqmjraw0r"; 57 }; 58 oc_4_4 = makeOverridable ocGen { 59 version = "4.4.33"; 60 sha256 = "1bf34331c7wixb1kmabp93sdpp4ihlyigx7nhmy71ffp7j82n419"; 61 }; 62 oc_4_3 = makeOverridable ocGen { 63 version = "4.3.40"; 64 sha256 = "04dkmw78dwniyjdvqyig7hafcicrn2ixg6bvqsy1y2plm0gsjmbz"; 65 }; 66 oc_4_2 = makeOverridable ocGen { 67 version = "4.2.36"; 68 sha256 = "1f9h58mx0a3zhpx11gim13hd3m4yzwa6ipbp1gwlghmhjz1jh35v"; 69 }; 70 oc_4_1 = makeOverridable ocGen { 71 version = "4.1.41"; 72 sha256 = "06wphg4vddhvavhxn07iq6pi3gq7ljbcdsgldwhyrjy8gx50bp47"; 73 }; 74 }