diff options
author | José Luis Lafuente <jl@lafuente.me> | 2019-10-31 17:05:06 +0100 |
---|---|---|
committer | José Luis Lafuente <jl@lafuente.me> | 2019-11-04 16:03:58 +0100 |
commit | 7622f30ed2115702e046b2fbd452a5d32af5c5fc (patch) | |
tree | 6b3b8319476f5f255a7bf8ba5901b27bae94ede0 /pkgs/tools/admin/pulumi/update.sh | |
parent | 9c68a03cdc9f7b9015760e0f51534dca76ab26c4 (diff) | |
download | nixpkgs-7622f30ed2115702e046b2fbd452a5d32af5c5fc.tar nixpkgs-7622f30ed2115702e046b2fbd452a5d32af5c5fc.tar.gz nixpkgs-7622f30ed2115702e046b2fbd452a5d32af5c5fc.tar.bz2 nixpkgs-7622f30ed2115702e046b2fbd452a5d32af5c5fc.tar.lz nixpkgs-7622f30ed2115702e046b2fbd452a5d32af5c5fc.tar.xz nixpkgs-7622f30ed2115702e046b2fbd452a5d32af5c5fc.tar.zst nixpkgs-7622f30ed2115702e046b2fbd452a5d32af5c5fc.zip |
pulumi: install providers and add update script
Without providers (also called plugins) pulumi doesn't do much. The way they work, if you want to use a provider, pulimi will look for it in your PATH, and if not found it will download it. Providers are just executables, but third party binaries usually don't work on nixos unless they are patched with the patchelf utility. Because of that, I'm installing some patched providers with the main pulumi binary. I'm also adding a small script helper to generate the hashes for all the binaries.
Diffstat (limited to 'pkgs/tools/admin/pulumi/update.sh')
-rw-r--r-- | pkgs/tools/admin/pulumi/update.sh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/pkgs/tools/admin/pulumi/update.sh b/pkgs/tools/admin/pulumi/update.sh new file mode 100644 index 00000000000..7cb500ee9d3 --- /dev/null +++ b/pkgs/tools/admin/pulumi/update.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +VERSION="1.4.0" + +declare -A plugins +plugins=( + ["aws"]="1.7.0" + ["gcp"]="1.4.1" + ["kubernetes"]="1.2.3" + ["random"]="0.2.0" +) + +function genMainSrc() { + local url="https://get.pulumi.com/releases/sdk/pulumi-v${VERSION}-$1-x64.tar.gz" + local sha256 + sha256=$(nix-prefetch-url "$url") + echo " {" + echo " url = \"${url}\";" + echo " sha256 = \"$sha256\";" + echo " }" +} + +function genSrcs() { + for plug in "${!plugins[@]}"; do + local version=${plugins[$plug]} + # url as defined here + # https://github.com/pulumi/pulumi/blob/06d4dde8898b2a0de2c3c7ff8e45f97495b89d82/pkg/workspace/plugins.go#L197 + local url="https://api.pulumi.com/releases/plugins/pulumi-resource-${plug}-v${version}-$1-amd64.tar.gz" + local sha256 + sha256=$(nix-prefetch-url "$url") + echo " {" + echo " url = \"${url}\";" + echo " sha256 = \"$sha256\";" + echo " }" + done +} + +cat <<EOF +# DO NOT EDIT! This file is generated automatically by update.sh +{ }: +{ + version = "${VERSION}"; + pulumiPkgs = { + x86_64-linux = [ +EOF +genMainSrc "linux" +genSrcs "linux" +echo " ];" + +echo " x86_64-darwin = [" +genMainSrc "darwin" +genSrcs "darwin" +echo " ];" +echo " };" +echo "}" |