3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/admin/pulumi/update.sh

63 lines
1.8 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2020-07-13 23:16:00 +01:00
VERSION="2.6.1"
2020-07-13 23:16:00 +01:00
# Bash 3 compatible for Darwin
plugins=(
2020-07-13 23:16:00 +01:00
# https://github.com/pulumi/pulumi-aws/releases
"aws=2.13.0"
# https://github.com/pulumi/pulumi-gcp/releases
"gcp=3.13.0"
# https://github.com/pulumi/pulumi-random/releases
"random=2.2.0"
# https://github.com/pulumi/pulumi-kubernetes/releases
"kubernetes=2.4.0"
# https://github.com/pulumi/pulumi-postgresql/releases
"postgresql=2.2.2");
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() {
2020-07-13 23:16:00 +01:00
for plugVers in "${plugins[@]}"; do
local plug=${plugVers%=*}
local version=${plugVers#*=}
# 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
}
2020-07-13 23:16:00 +01:00
cat <<EOF > data.nix
# DO NOT EDIT! This file is generated automatically by update.sh
{ }:
{
version = "${VERSION}";
pulumiPkgs = {
x86_64-linux = [
EOF
2020-07-13 23:16:00 +01:00
genMainSrc "linux" >> data.nix
genSrcs "linux" >> data.nix
echo " ];" >> data.nix
echo " x86_64-darwin = [" >> data.nix
genMainSrc "darwin" >> data.nix
genSrcs "darwin" >> data.nix
echo " ];" >> data.nix
echo " };" >> data.nix
echo "}" >> data.nix