Merge pull request #72373 from jlesquembre/pulumi-fix

pulumi: install providers and add update script

authored by Dmitry Kalinkin and committed by GitHub 72724911 d1473e03

+115 -18
+51
pkgs/tools/admin/pulumi/data.nix
··· 1 + # DO NOT EDIT! This file is generated automatically by update.sh 2 + { }: 3 + { 4 + version = "1.4.0"; 5 + pulumiPkgs = { 6 + x86_64-linux = [ 7 + { 8 + url = "https://get.pulumi.com/releases/sdk/pulumi-v1.4.0-linux-x64.tar.gz"; 9 + sha256 = "00ywy2ba4xha6gwd42i3fdrk1myivkd1r6ijdr2vkianmg524k6f"; 10 + } 11 + { 12 + url = "https://api.pulumi.com/releases/plugins/pulumi-resource-random-v0.2.0-linux-amd64.tar.gz"; 13 + sha256 = "1hj4gysjipd091f106a7xz02g9cail5d11rn6j08m0xphg9cf3fn"; 14 + } 15 + { 16 + url = "https://api.pulumi.com/releases/plugins/pulumi-resource-gcp-v1.4.1-linux-amd64.tar.gz"; 17 + sha256 = "0r6xpsb2riqmxwxw28lbi3xd7w4ds510gw99j1rr57h5b9bq19jj"; 18 + } 19 + { 20 + url = "https://api.pulumi.com/releases/plugins/pulumi-resource-kubernetes-v1.2.3-linux-amd64.tar.gz"; 21 + sha256 = "0m7fajy3cy1agsz787ak548khwj8rwahs1ibaswqfyyw092iyzb9"; 22 + } 23 + { 24 + url = "https://api.pulumi.com/releases/plugins/pulumi-resource-aws-v1.7.0-linux-amd64.tar.gz"; 25 + sha256 = "1qw90l7h8yn06bz2l2995nbrc3svs223dm3ys1807amj4n2jyfwb"; 26 + } 27 + ]; 28 + x86_64-darwin = [ 29 + { 30 + url = "https://get.pulumi.com/releases/sdk/pulumi-v1.4.0-darwin-x64.tar.gz"; 31 + sha256 = "02vqw9gn17dy3rfh0j00k9f827l42g3nl3rhlcbc8jbgx3n9c9qy"; 32 + } 33 + { 34 + url = "https://api.pulumi.com/releases/plugins/pulumi-resource-random-v0.2.0-darwin-amd64.tar.gz"; 35 + sha256 = "077j9fp8ix00rcqrq8qxk3kvz6gz6sknzb2iv3qjvkh6yh292mz3"; 36 + } 37 + { 38 + url = "https://api.pulumi.com/releases/plugins/pulumi-resource-gcp-v1.4.1-darwin-amd64.tar.gz"; 39 + sha256 = "1i2vf3bxwf8awvw183hq9bbnmznda1jpv1zqghgz2ybx4s0915nx"; 40 + } 41 + { 42 + url = "https://api.pulumi.com/releases/plugins/pulumi-resource-kubernetes-v1.2.3-darwin-amd64.tar.gz"; 43 + sha256 = "123czx1c31r5r91k2jhdgmnffypnl8w1a6h9mr2rdhwgbx8hzq40"; 44 + } 45 + { 46 + url = "https://api.pulumi.com/releases/plugins/pulumi-resource-aws-v1.7.0-darwin-amd64.tar.gz"; 47 + sha256 = "0cl0vakppxi0v8ym8b4fzhzb10nl84wd0vfik8gpfwsg7zwdzhlp"; 48 + } 49 + ]; 50 + }; 51 + }
+9 -18
pkgs/tools/admin/pulumi/default.nix
··· 3 3 with lib; 4 4 5 5 let 6 - 7 - version = "1.4.0"; 8 - 9 - # switch the dropdown to “manual” on https://pulumi.io/quickstart/install.html # TODO: update script 10 - pulumiArchPackage = { 11 - x86_64-linux = { 12 - url = "https://get.pulumi.com/releases/sdk/pulumi-v${version}-linux-x64.tar.gz"; 13 - sha256 = "00ywy2ba4xha6gwd42i3fdrk1myivkd1r6ijdr2vkianmg524k6f"; 14 - }; 15 - x86_64-darwin = { 16 - url = "https://get.pulumi.com/releases/sdk/pulumi-v${version}-darwin-x64.tar.gz"; 17 - sha256 = "02vqw9gn17dy3rfh0j00k9f827l42g3nl3rhlcbc8jbgx3n9c9qy"; 18 - }; 19 - }; 20 - 6 + data = import ./data.nix {}; 21 7 in stdenv.mkDerivation { 22 - inherit version; 23 8 pname = "pulumi"; 9 + version = data.version; 24 10 25 - src = fetchurl pulumiArchPackage.${stdenv.hostPlatform.system}; 11 + postUnpack = '' 12 + mv pulumi-* pulumi 13 + ''; 14 + 15 + srcs = map (x: fetchurl x) data.pulumiPkgs.${stdenv.hostPlatform.system}; 26 16 27 17 installPhase = '' 28 18 mkdir -p $out/bin ··· 35 25 homepage = https://pulumi.io/; 36 26 description = "Pulumi is a cloud development platform that makes creating cloud programs easy and productive"; 37 27 license = with licenses; [ asl20 ]; 38 - platforms = builtins.attrNames pulumiArchPackage; 28 + platforms = builtins.attrNames data.pulumiPkgs; 39 29 maintainers = with maintainers; [ 40 30 peterromfeldhk 31 + jlesquembre 41 32 ]; 42 33 }; 43 34 }
+55
pkgs/tools/admin/pulumi/update.sh
··· 1 + #!/usr/bin/env bash 2 + 3 + VERSION="1.4.0" 4 + 5 + declare -A plugins 6 + plugins=( 7 + ["aws"]="1.7.0" 8 + ["gcp"]="1.4.1" 9 + ["kubernetes"]="1.2.3" 10 + ["random"]="0.2.0" 11 + ) 12 + 13 + function genMainSrc() { 14 + local url="https://get.pulumi.com/releases/sdk/pulumi-v${VERSION}-$1-x64.tar.gz" 15 + local sha256 16 + sha256=$(nix-prefetch-url "$url") 17 + echo " {" 18 + echo " url = \"${url}\";" 19 + echo " sha256 = \"$sha256\";" 20 + echo " }" 21 + } 22 + 23 + function genSrcs() { 24 + for plug in "${!plugins[@]}"; do 25 + local version=${plugins[$plug]} 26 + # url as defined here 27 + # https://github.com/pulumi/pulumi/blob/06d4dde8898b2a0de2c3c7ff8e45f97495b89d82/pkg/workspace/plugins.go#L197 28 + local url="https://api.pulumi.com/releases/plugins/pulumi-resource-${plug}-v${version}-$1-amd64.tar.gz" 29 + local sha256 30 + sha256=$(nix-prefetch-url "$url") 31 + echo " {" 32 + echo " url = \"${url}\";" 33 + echo " sha256 = \"$sha256\";" 34 + echo " }" 35 + done 36 + } 37 + 38 + cat <<EOF 39 + # DO NOT EDIT! This file is generated automatically by update.sh 40 + { }: 41 + { 42 + version = "${VERSION}"; 43 + pulumiPkgs = { 44 + x86_64-linux = [ 45 + EOF 46 + genMainSrc "linux" 47 + genSrcs "linux" 48 + echo " ];" 49 + 50 + echo " x86_64-darwin = [" 51 + genMainSrc "darwin" 52 + genSrcs "darwin" 53 + echo " ];" 54 + echo " };" 55 + echo "}"