diff options
author | Vincent Ambo <mail@tazj.in> | 2022-02-08 19:41:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-08 17:41:03 +0100 |
commit | 2fcfc72e682fa7d1e5c7dc33d5cda16188b48112 (patch) | |
tree | e392cbc1286c8bd0d2d356583886b7cf1c2167d7 /pkgs/applications/networking/cluster/terraform-providers | |
parent | 819bf6b10a1cd3a0f0e6e7df6d556b5acb36bbee (diff) | |
download | nixpkgs-2fcfc72e682fa7d1e5c7dc33d5cda16188b48112.tar nixpkgs-2fcfc72e682fa7d1e5c7dc33d5cda16188b48112.tar.gz nixpkgs-2fcfc72e682fa7d1e5c7dc33d5cda16188b48112.tar.bz2 nixpkgs-2fcfc72e682fa7d1e5c7dc33d5cda16188b48112.tar.lz nixpkgs-2fcfc72e682fa7d1e5c7dc33d5cda16188b48112.tar.xz nixpkgs-2fcfc72e682fa7d1e5c7dc33d5cda16188b48112.tar.zst nixpkgs-2fcfc72e682fa7d1e5c7dc33d5cda16188b48112.zip |
terraform-providers: wrap mkProvider in lib.makeOverridable (#158618)
This allows for an easier interface for doing things like overriding the version of a specific Terraform provider, which is a fairly common use-case.
Diffstat (limited to 'pkgs/applications/networking/cluster/terraform-providers')
-rw-r--r-- | pkgs/applications/networking/cluster/terraform-providers/default.nix | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/pkgs/applications/networking/cluster/terraform-providers/default.nix b/pkgs/applications/networking/cluster/terraform-providers/default.nix index 8690e65be88..53e3aab6349 100644 --- a/pkgs/applications/networking/cluster/terraform-providers/default.nix +++ b/pkgs/applications/networking/cluster/terraform-providers/default.nix @@ -10,42 +10,42 @@ let # Our generic constructor to build new providers. # # Is designed to combine with the terraform.withPlugins implementation. - mkProvider = - { owner - , repo - , rev - , version - , sha256 - , vendorSha256 ? throw "vendorSha256 missing: please use `buildGoModule`" /* added 2022/01 */ - , deleteVendor ? false - , proxyVendor ? false - , # Looks like "registry.terraform.io/vancluever/acme" - provider-source-address - }@attrs: - buildGoModule { - pname = repo; - inherit vendorSha256 version deleteVendor proxyVendor; - subPackages = [ "." ]; - doCheck = false; - # https://github.com/hashicorp/terraform-provider-scaffolding/blob/a8ac8375a7082befe55b71c8cbb048493dd220c2/.goreleaser.yml - # goreleaser (used for builds distributed via terraform registry) requires that CGO is disabled - CGO_ENABLED = 0; - ldflags = [ "-s" "-w" "-X main.version=${version}" "-X main.commit=${rev}" ]; - src = fetchFromGitHub { - inherit owner repo rev sha256; - }; + mkProvider = lib.makeOverridable + ({ owner + , repo + , rev + , version + , sha256 + , vendorSha256 ? throw "vendorSha256 missing: please use `buildGoModule`" /* added 2022/01 */ + , deleteVendor ? false + , proxyVendor ? false + , # Looks like "registry.terraform.io/vancluever/acme" + provider-source-address + }@attrs: + buildGoModule { + pname = repo; + inherit vendorSha256 version deleteVendor proxyVendor; + subPackages = [ "." ]; + doCheck = false; + # https://github.com/hashicorp/terraform-provider-scaffolding/blob/a8ac8375a7082befe55b71c8cbb048493dd220c2/.goreleaser.yml + # goreleaser (used for builds distributed via terraform registry) requires that CGO is disabled + CGO_ENABLED = 0; + ldflags = [ "-s" "-w" "-X main.version=${version}" "-X main.commit=${rev}" ]; + src = fetchFromGitHub { + inherit owner repo rev sha256; + }; - # Move the provider to libexec - postInstall = '' - dir=$out/libexec/terraform-providers/${provider-source-address}/${version}/''${GOOS}_''${GOARCH} - mkdir -p "$dir" - mv $out/bin/* "$dir/terraform-provider-$(basename ${provider-source-address})_${version}" - rmdir $out/bin - ''; + # Move the provider to libexec + postInstall = '' + dir=$out/libexec/terraform-providers/${provider-source-address}/${version}/''${GOOS}_''${GOARCH} + mkdir -p "$dir" + mv $out/bin/* "$dir/terraform-provider-$(basename ${provider-source-address})_${version}" + rmdir $out/bin + ''; - # Keep the attributes around for later consumption - passthru = attrs; - }; + # Keep the attributes around for later consumption + passthru = attrs; + }); list = lib.importJSON ./providers.json; |