terraform-providers: fix impurity about Nix version used

I wasn't able to figure out for which unstable version of Nix this is
supposed to work so I added nix itself to the package list. Nix will now
be the same stable version that is also provided in this nixpkgs
checkout.

To make it work with a stable Nix version I also had to trim the build
error output as otherwise it would contain the sha256 prefix & a newline
followed by "error:".
This commit is contained in:
Andreas Rammhold 2021-02-08 15:28:12 +01:00
parent 61e6aeb6b2
commit e3a4ba0052
No known key found for this signature in database
GPG Key ID: E432E410B5E48C86

View File

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p coreutils curl jq moreutils
#! nix-shell -I nixpkgs=../../../../.. -i bash -p coreutils curl jq moreutils nix
# shellcheck shell=bash
# vim: ft=sh
#
@ -161,7 +161,8 @@ if [[ -z "$vendorSha256" ]]; then
exit 1
fi
rm -f vendor_log.txt
vendorSha256=${BASH_REMATCH[1]}
# trim the results in case it they have a sha256: prefix or contain more than one line
vendorSha256=$(echo "${BASH_REMATCH[1]#sha256:}" | head -n 1)
# Deal with nix unstable
if [[ $vendorSha256 = sha256-* ]]; then
vendorSha256=$(nix to-base32 "$vendorSha256")