Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 84 lines 2.4 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 installShellFiles, 6 writableTmpDirAsHomeHook, 7}: 8let 9 arch = 10 with stdenv.hostPlatform; 11 if isx86_64 then 12 "amd64" 13 else if isAarch64 then 14 "arm64" 15 else if isi686 then 16 "386" 17 else if isPower64 && isLittleEndian then 18 "ppc64le" 19 else if isS390x then 20 "s390x" 21 else 22 throw "Unsupported arch: ${stdenv.hostPlatform.system}"; 23 platform = 24 if stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 then 25 "macos_arm64" 26 else if stdenv.hostPlatform.isDarwin then 27 "macos" 28 else 29 "linux_${arch}"; 30in 31stdenv.mkDerivation (finalAttrs: { 32 pname = "ibmcloud-cli"; 33 version = "2.34.2"; 34 35 src = fetchurl { 36 url = "https://download.clis.cloud.ibm.com/ibm-cloud-cli/${finalAttrs.version}/binaries/IBM_Cloud_CLI_${finalAttrs.version}_${platform}.tgz"; 37 hash = 38 { 39 "x86_64-darwin" = "sha256-StOJEaQyPAObCz6DPO5i0Kj6s5RoHzyEWMh2C0sov3U="; 40 "aarch64-darwin" = "sha256-sur1M0PoRibj551iExCSyXYXlEGwjDqA2n7BP8JtCIU="; 41 "x86_64-linux" = "sha256-UoP9kPe+00jdwCQYbZB2z1OorZ8cvlQLjY0wWx/RukI="; 42 "aarch64-linux" = "sha256-FIYqbubVyuzn1yQ7jejG82ZHvPZD7NmTWUV1TD1LbuE="; 43 "i686-linux" = "sha256-JC8UIvMpENbucZ8aVeOr2PsqKa9xg2UXh7zLTPVQ1yg="; 44 "powerpc64le-linux" = "sha256-q8VqZkfCf6+K1aGheYgxQB06i8ua1AMojPp8U3flcmo="; 45 "s390x-linux" = "sha256-4wYEJZ/+65+1j3JdctY2ZIC5cNKLl8Kc3c9Azlh7HaM="; 46 } 47 .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); 48 }; 49 50 nativeBuildInputs = [ 51 installShellFiles 52 writableTmpDirAsHomeHook 53 ]; 54 55 installPhase = '' 56 runHook preInstall 57 58 install -Dm755 ibmcloud $out/bin/ibmcloud 59 mkdir -p $out/share/ibmcloud 60 cp LICENSE NOTICE $out/share/ibmcloud 61 installShellCompletion --cmd ibmcloud --bash <($out/bin/ibmcloud --generate-bash-completion) 62 63 runHook postInstall 64 ''; 65 66 passthru.updateScript = ./update.sh; 67 68 meta = { 69 description = "Command line client for IBM Cloud"; 70 homepage = "https://cloud.ibm.com/docs/cli"; 71 license = lib.licenses.asl20; 72 maintainers = with lib.maintainers; [ emilytrau ]; 73 platforms = [ 74 "x86_64-linux" 75 "aarch64-linux" 76 "i686-linux" 77 "powerpc64le-linux" 78 "s390x-linux" 79 ] 80 ++ lib.platforms.darwin; 81 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 82 mainProgram = "ibmcloud"; 83 }; 84})