diff --git a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
index f1c6644b67e1..ea2388c1bdb1 100644
--- a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
+++ b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml
@@ -397,6 +397,24 @@
~/.local/share/polymc/polymc.cfg.
+
+
+ The terraform 0.12 compatibility has been removed and the
+ terraform.withPlugins and
+ terraform-providers.mkProvider
+ implementations simplified. Providers now need to be stored
+ under
+ $out/libexec/terraform-providers/<registry>/<owner>/<name>/<version>/<os>_<arch>/terraform-provider-<name>_v<version>
+ (which mkProvider does).
+
+
+ This breaks back-compat so it’s not possible to mix-and-match
+ with previous versions of nixpkgs. In exchange, it now becomes
+ possible to use the providers from
+ nixpkgs-terraform-providers-bin
+ directly.
+
+ pkgs.noto-fonts-cjk is now deprecated in
diff --git a/nixos/doc/manual/release-notes/rl-2205.section.md b/nixos/doc/manual/release-notes/rl-2205.section.md
index 525955f8c9f4..673a82a408c1 100644
--- a/nixos/doc/manual/release-notes/rl-2205.section.md
+++ b/nixos/doc/manual/release-notes/rl-2205.section.md
@@ -124,6 +124,11 @@ In addition to numerous new and upgraded packages, this release has the followin
- MultiMC has been replaced with the fork PolyMC due to upstream developers being hostile to 3rd party package maintainers. PolyMC removes all MultiMC branding and is aimed at providing proper 3rd party packages like the one contained in Nixpkgs. This change affects the data folder where game instances and other save and configuration files are stored. Users with existing installations should rename `~/.local/share/multimc` to `~/.local/share/polymc`. The main config file's path has also moved from `~/.local/share/multimc/multimc.cfg` to `~/.local/share/polymc/polymc.cfg`.
+- The terraform 0.12 compatibility has been removed and the `terraform.withPlugins` and `terraform-providers.mkProvider` implementations simplified. Providers now need to be stored under
+`$out/libexec/terraform-providers/////_/terraform-provider-_v` (which mkProvider does).
+
+ This breaks back-compat so it's not possible to mix-and-match with previous versions of nixpkgs. In exchange, it now becomes possible to use the providers from [nixpkgs-terraform-providers-bin](https://github.com/numtide/nixpkgs-terraform-providers-bin) directly.
+
- `pkgs.noto-fonts-cjk` is now deprecated in favor of `pkgs.noto-fonts-cjk-sans`
and `pkgs.noto-fonts-cjk-serif` because they each have different release
schedules. To maintain compatibility with prior releases of Nixpkgs,
diff --git a/pkgs/applications/networking/cluster/terraform-providers/default.nix b/pkgs/applications/networking/cluster/terraform-providers/default.nix
index 47bd402a2240..8690e65be88c 100644
--- a/pkgs/applications/networking/cluster/terraform-providers/default.nix
+++ b/pkgs/applications/networking/cluster/terraform-providers/default.nix
@@ -19,7 +19,8 @@ let
, vendorSha256 ? throw "vendorSha256 missing: please use `buildGoModule`" /* added 2022/01 */
, deleteVendor ? false
, proxyVendor ? false
- , provider-source-address
+ , # Looks like "registry.terraform.io/vancluever/acme"
+ provider-source-address
}@attrs:
buildGoModule {
pname = repo;
@@ -34,9 +35,15 @@ let
inherit owner repo rev sha256;
};
- # Terraform allow checking the provider versions, but this breaks
- # if the versions are not provided via file paths.
- postBuild = "mv $NIX_BUILD_TOP/go/bin/${repo}{,_v${version}}";
+ # 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;
};
diff --git a/pkgs/applications/networking/cluster/terraform/default.nix b/pkgs/applications/networking/cluster/terraform/default.nix
index bc179ea55eb1..a5e92bedef6a 100644
--- a/pkgs/applications/networking/cluster/terraform/default.nix
+++ b/pkgs/applications/networking/cluster/terraform/default.nix
@@ -1,5 +1,6 @@
{ stdenv
, lib
+, buildEnv
, buildGoModule
, fetchFromGitHub
, makeWrapper
@@ -62,9 +63,9 @@ let
babariviere
kalbasit
marsam
+ maxeaubrey
timstott
zimbatm
- maxeaubrey
zowoq
];
};
@@ -76,39 +77,6 @@ let
let
actualPlugins = plugins terraform.plugins;
- # Make providers available in Terraform 0.13 and 0.12 search paths.
- pluginDir = lib.concatMapStrings
- (pl:
- let
- inherit (pl) version GOOS GOARCH;
-
- pname = pl.pname or (throw "${pl.name} is missing a pname attribute");
-
- # This is just the name, without the terraform-provider- prefix
- plugin_name = lib.removePrefix "terraform-provider-" pname;
-
- slug = pl.passthru.provider-source-address or "registry.terraform.io/nixpkgs/${plugin_name}";
-
- shim = writeText "shim" ''
- #!${runtimeShell}
- exec ${pl}/bin/${pname}_v${version} "$@"
- '';
- in
- ''
- TF_0_13_PROVIDER_PATH=$out/plugins/${slug}/${version}/${GOOS}_${GOARCH}/${pname}_v${version}
- mkdir -p "$(dirname $TF_0_13_PROVIDER_PATH)"
-
- cp ${shim} "$TF_0_13_PROVIDER_PATH"
- chmod +x "$TF_0_13_PROVIDER_PATH"
-
- TF_0_12_PROVIDER_PATH=$out/plugins/${pname}_v${version}
-
- cp ${shim} "$TF_0_12_PROVIDER_PATH"
- chmod +x "$TF_0_12_PROVIDER_PATH"
- ''
- )
- actualPlugins;
-
# Wrap PATH of plugins propagatedBuildInputs, plugins may have runtime dependencies on external binaries
wrapperInputs = lib.unique (lib.flatten
(lib.catAttrs "propagatedBuildInputs"
@@ -134,18 +102,16 @@ let
terraform.overrideAttrs
(orig: { passthru = orig.passthru // passthru; })
else
- lib.appendToName "with-plugins" (stdenv.mkDerivation {
+ lib.appendToName "with-plugins" (buildEnv {
inherit (terraform) name meta;
+ paths = actualPlugins;
nativeBuildInputs = [ makeWrapper ];
-
- buildCommand = pluginDir + ''
- mkdir -p $out/bin/
+ postBuild = ''
+ mkdir -p $out/bin
makeWrapper "${terraform}/bin/terraform" "$out/bin/terraform" \
- --set NIX_TERRAFORM_PLUGIN_DIR $out/plugins \
+ --set NIX_TERRAFORM_PLUGIN_DIR $out/libexec/terraform-providers \
--prefix PATH : "${lib.makeBinPath wrapperInputs}"
'';
-
- inherit passthru;
});
in
withPlugins (_: [ ]);