terraform-providers: add passthru.updateScript

- drop nix-shell nixpkgs path
This commit is contained in:
zowoq 2022-09-09 11:25:31 +10:00
parent 5fabd2ba5a
commit 3e63fa279f
3 changed files with 13 additions and 3 deletions

View file

@ -4,6 +4,7 @@
, fetchFromGitHub
, callPackage
, config
, writeShellScript
, cdrtools # libvirt
}:
@ -47,7 +48,12 @@ let
'';
# Keep the attributes around for later consumption
passthru = attrs;
passthru = attrs // {
updateScript = writeShellScript "update" ''
provider="$(basename ${provider-source-address})"
./pkgs/applications/networking/cluster/terraform-providers/update-provider --no-build "$provider"
'';
};
});
list = lib.importJSON ./providers.json;

View file

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#! nix-shell -I nixpkgs=../../../../.. -i bash -p jq
#! nix-shell -i bash -p jq
# shellcheck shell=bash
# Update all providers which have specified provider source address

View file

@ -1,5 +1,5 @@
#!/usr/bin/env nix-shell
#! nix-shell -I nixpkgs=../../../../.. -i bash -p coreutils curl git jq moreutils nix nix-prefetch
#! nix-shell -i bash -p coreutils curl git jq moreutils nix nix-prefetch
# shellcheck shell=bash
# vim: ft=sh
#
@ -100,6 +100,8 @@ echo_provider() {
echo "== terraform-providers.${provider}: $* =="
}
pushd "$(dirname "$0")"
if [[ ${provider} =~ ^[^/]+/[^/]+$ ]]; then
echo_provider "init"
source_address=registry.terraform.io/${provider}
@ -164,3 +166,5 @@ if [[ ${build} == 1 ]]; then
echo_provider "building"
nix-build --no-out-link "${repo_root}" -A "terraform-providers.${provider}"
fi
popd