diff --git a/pkgs/by-name/op/opentofu/package.nix b/pkgs/by-name/op/opentofu/package.nix index 85d9952b8c52..e73a6e6b27f0 100644 --- a/pkgs/by-name/op/opentofu/package.nix +++ b/pkgs/by-name/op/opentofu/package.nix @@ -108,28 +108,7 @@ let withPlugins = plugins: let - actualPlugins = lib.lists.map ( - provider: - if provider ? override then - # use opentofu plugin registry over terraform's - provider.override ( - oldArgs: - if (builtins.hasAttr "homepage" oldArgs) then - { - provider-source-address = - lib.replaceStrings - [ "https://registry.terraform.io/providers" ] - [ - "registry.opentofu.org" - ] - oldArgs.homepage; - } - else - { } - ) - else - provider - ) (plugins package.plugins); + actualPlugins = plugins package.plugins; # Wrap PATH of plugins propagatedBuildInputs, plugins may have runtime dependencies on external binaries wrapperInputs = lib.unique ( @@ -183,13 +162,16 @@ let passthru = package.passthru // passthru; buildCommand = '' - # Create wrappers for terraform plugins because Terraform only + # Create wrappers for terraform plugins because OpenTofu only # walks inside of a tree of files. + # Also replace registry.terraform.io dir with registry.opentofu.org, + # so OpenTofu can find the plugins. for providerDir in ${toString actualPlugins} do for file in $(find $providerDir/libexec/terraform-providers -type f) do relFile=''${file#$providerDir/} + relFile=''${relFile/registry.terraform.io/registry.opentofu.org} mkdir -p $out/$(dirname $relFile) cat < $out/$relFile #!${runtimeShell}