Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 16.09 60 lines 2.1 kB view raw
1{stdenv, fetchurl, python27, python27Packages, makeWrapper}: 2 3with python27Packages; 4 5stdenv.mkDerivation rec { 6 name = "google-cloud-sdk-${version}"; 7 version = "122.0.0"; 8 9 src = 10 if stdenv.system == "i686-linux" then 11 fetchurl { 12 url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/${name}-linux-x86.tar.gz"; 13 sha256 = "0nx348yx1avbb34bpj316fb7jzyzkylscyx8kv183rg4s1q2f798"; 14 } 15 else 16 fetchurl { 17 url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/${name}-linux-x86_64.tar.gz"; 18 sha256 = "0jhw8yv2kv0fs64rzvddx3szzpn74nqnd3rbd9wx2vi6nmffkrwv"; 19 }; 20 21 buildInputs = [python27 makeWrapper]; 22 23 phases = [ "installPhase" "fixupPhase" ]; 24 25 installPhase = '' 26 mkdir -p "$out" 27 tar -xzf "$src" -C "$out" google-cloud-sdk 28 29 # create wrappers with correct env 30 for program in gcloud bq gsutil git-credential-gcloud.sh; do 31 programPath="$out/google-cloud-sdk/bin/$program" 32 wrapper="$out/bin/$program" 33 makeWrapper "$programPath" "$wrapper" \ 34 --set CLOUDSDK_PYTHON "${python27}/bin/python" \ 35 --prefix PYTHONPATH : "$(toPythonPath ${cffi}):$(toPythonPath ${cryptography}):$(toPythonPath ${pyopenssl}):$(toPythonPath ${crcmod})" 36 done 37 38 # install man pages 39 mv "$out/google-cloud-sdk/help/man" "$out" 40 41 # setup bash completion 42 mkdir -p "$out/etc/bash_completion.d/" 43 mv "$out/google-cloud-sdk/completion.bash.inc" "$out/etc/bash_completion.d/gcloud.inc" 44 45 # This directory contains compiled mac binaries. We used crcmod from 46 # nixpkgs instead. 47 rm -r $out/google-cloud-sdk/platform/gsutil/third_party/crcmod 48 ''; 49 50 meta = with stdenv.lib; { 51 description = "Tools for the google cloud platform"; 52 longDescription = "The Google Cloud SDK. This package has the programs: gcloud, gsutil, and bq"; 53 version = version; 54 # This package contains vendored dependencies. All have free licenses. 55 license = licenses.free; 56 homepage = "https://cloud.google.com/sdk/"; 57 maintainers = with maintainers; [stephenmw zimbatm]; 58 platforms = platforms.linux; 59 }; 60}