From fe01411bf46e8af2ac8f06a11a09114a02bf0f83 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Fri, 22 Nov 2024 11:04:04 -0500 Subject: [PATCH 1/3] opentofu: 1.8.5 -> 1.8.6 Diff: https://github.com/opentofu/opentofu/compare/v1.8.5...v1.8.6 Changelog: https://github.com/opentofu/opentofu/blob/v1.8.6/CHANGELOG.md (cherry picked from commit d63d41ffd4fc7ff3c06bb5f07b14876d7c4f4a3a) --- pkgs/by-name/op/opentofu/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/op/opentofu/package.nix b/pkgs/by-name/op/opentofu/package.nix index 03211c593a3c..a3c25bbc9e7b 100644 --- a/pkgs/by-name/op/opentofu/package.nix +++ b/pkgs/by-name/op/opentofu/package.nix @@ -14,16 +14,16 @@ let package = buildGoModule rec { pname = "opentofu"; - version = "1.8.5"; + version = "1.8.6"; src = fetchFromGitHub { owner = "opentofu"; repo = "opentofu"; rev = "v${version}"; - hash = "sha256-sZGKM6Dxz0bZkHIITujojSsKtRD4E+q1uReWRg5EfC8="; + hash = "sha256-yJCUWRAntye3Dx2a+s/gNVa+XuCQak24TnFjSY+/3zc="; }; - vendorHash = "sha256-cM2DSP2ss3vleUhPBIdyxKeWJxtHpdjL5b5HVS/iC6o="; + vendorHash = "sha256-MHdEY2nlUGTKybMPran5mTXlAlTFilfrY5K2sMlPe5U="; ldflags = [ "-s" "-w" "-X" "github.com/opentofu/opentofu/version.dev=no" ]; postConfigure = '' From 8091872dce5843c3347adcba1b51b5a09ec48e4c Mon Sep 17 00:00:00 2001 From: Kiara Grouwstra Date: Sat, 23 Nov 2024 12:40:45 +0100 Subject: [PATCH 2/3] opentofu: apply nixfmt (cherry picked from commit 187ef4d65ba3382effedac243256d2fd12d5567e) --- pkgs/by-name/op/opentofu/package.nix | 115 ++++++++++++++------------- 1 file changed, 61 insertions(+), 54 deletions(-) diff --git a/pkgs/by-name/op/opentofu/package.nix b/pkgs/by-name/op/opentofu/package.nix index a3c25bbc9e7b..9c633b6c5ae0 100644 --- a/pkgs/by-name/op/opentofu/package.nix +++ b/pkgs/by-name/op/opentofu/package.nix @@ -1,18 +1,19 @@ -{ stdenv -, lib -, buildGoModule -, fetchFromGitHub -, makeWrapper -, coreutils -, runCommand -, runtimeShell -, writeText -, terraform-providers -, installShellFiles +{ + stdenv, + lib, + buildGoModule, + fetchFromGitHub, + makeWrapper, + coreutils, + runCommand, + runtimeShell, + writeText, + terraform-providers, + installShellFiles, }: let - package = buildGoModule rec { + package = buildGoModule rec { pname = "opentofu"; version = "1.8.6"; @@ -24,7 +25,12 @@ let }; vendorHash = "sha256-MHdEY2nlUGTKybMPran5mTXlAlTFilfrY5K2sMlPe5U="; - ldflags = [ "-s" "-w" "-X" "github.com/opentofu/opentofu/version.dev=no" ]; + ldflags = [ + "-s" + "-w" + "-X" + "github.com/opentofu/opentofu/version.dev=no" + ]; postConfigure = '' # speakeasy hardcodes /bin/stty https://github.com/bgentry/speakeasy/issues/22 @@ -37,7 +43,9 @@ let passthru = { inherit full plugins withPlugins; - tests = { inherit opentofu_plugins_test; }; + tests = { + inherit opentofu_plugins_test; + }; }; # https://github.com/posener/complete/blob/9a4745ac49b29530e07dc2581745a218b646b7a3/cmd/install/bash.go#L8 @@ -67,29 +75,28 @@ let full = withPlugins (p: lib.filter lib.isDerivation (lib.attrValues p.actualProviders)); - opentofu_plugins_test = let - mainTf = writeText "main.tf" '' - terraform { - required_providers { - random = { - source = "registry.terraform.io/hashicorp/random" + opentofu_plugins_test = + let + mainTf = writeText "main.tf" '' + terraform { + required_providers { + random = { + source = "registry.terraform.io/hashicorp/random" + } } } - } - resource "random_id" "test" {} - ''; - opentofu = package.withPlugins (p: [ p.random ]); - test = runCommand "opentofu-plugin-test" { - buildInputs = [ opentofu ]; - } '' - # make it fail outside of sandbox - export HTTP_PROXY=http://127.0.0.1:0 HTTPS_PROXY=https://127.0.0.1:0 - cp ${mainTf} main.tf - tofu init - touch $out - ''; - in + resource "random_id" "test" {} + ''; + opentofu = package.withPlugins (p: [ p.random ]); + test = runCommand "opentofu-plugin-test" { buildInputs = [ opentofu ]; } '' + # make it fail outside of sandbox + export HTTP_PROXY=http://127.0.0.1:0 HTTPS_PROXY=https://127.0.0.1:0 + cp ${mainTf} main.tf + tofu init + touch $out + ''; + in test; plugins = removeAttrs terraform-providers [ @@ -98,18 +105,18 @@ let "recurseForDerivations" ]; - withPlugins = plugins: + withPlugins = + plugins: let actualPlugins = plugins package.plugins; # Wrap PATH of plugins propagatedBuildInputs, plugins may have runtime dependencies on external binaries - wrapperInputs = lib.unique (lib.flatten - (lib.catAttrs "propagatedBuildInputs" - (builtins.filter (x: x != null) actualPlugins))); + wrapperInputs = lib.unique ( + lib.flatten (lib.catAttrs "propagatedBuildInputs" (builtins.filter (x: x != null) actualPlugins)) + ); passthru = { - withPlugins = newplugins: - withPlugins (x: newplugins x ++ actualPlugins); + withPlugins = newplugins: withPlugins (x: newplugins x ++ actualPlugins); # Expose wrappers around the override* functions of the terraform # derivation. @@ -131,21 +138,20 @@ let # 3. Specifying overrides on the wrapper is unsupported. # # See nixpkgs#158620 for details. - overrideDerivation = f: - (package.overrideDerivation f).withPlugins plugins; - overrideAttrs = f: - (package.overrideAttrs f).withPlugins plugins; - override = x: - (package.override x).withPlugins plugins; + overrideDerivation = f: (package.overrideDerivation f).withPlugins plugins; + overrideAttrs = f: (package.overrideAttrs f).withPlugins plugins; + override = x: (package.override x).withPlugins plugins; }; - # Don't bother wrapping unless we actually have plugins, since the wrapper will stop automatic downloading - # of plugins, which might be counterintuitive if someone just wants a vanilla Terraform. in - if actualPlugins == [ ] then - package.overrideAttrs - (orig: { passthru = orig.passthru // passthru; }) - else - lib.appendToName "with-plugins" (stdenv.mkDerivation { + # Don't bother wrapping unless we actually have plugins, since the wrapper will stop automatic downloading + # of plugins, which might be counterintuitive if someone just wants a vanilla Terraform. + if actualPlugins == [ ] then + package.overrideAttrs (orig: { + passthru = orig.passthru // passthru; + }) + else + lib.appendToName "with-plugins" ( + stdenv.mkDerivation { inherit (package) meta pname version; nativeBuildInputs = [ makeWrapper ]; @@ -178,6 +184,7 @@ let --set NIX_TERRAFORM_PLUGIN_DIR $out/libexec/terraform-providers \ --prefix PATH : "${lib.makeBinPath wrapperInputs}" ''; - }); + } + ); in package From e82d1a7ab513558631350321278588f9f3e8b2f1 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Thu, 5 Dec 2024 10:19:15 -0500 Subject: [PATCH 3/3] opentofu: 1.8.6 -> 1.8.7 Diff: https://github.com/opentofu/opentofu/compare/v1.8.6...v1.8.7 Changelog: https://github.com/opentofu/opentofu/blob/v1.8.7/CHANGELOG.md (cherry picked from commit 4ae5e6518e133ba5a6e14d321f6fd1ab9e5a57bb) --- pkgs/by-name/op/opentofu/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/op/opentofu/package.nix b/pkgs/by-name/op/opentofu/package.nix index 9c633b6c5ae0..c83662d5014a 100644 --- a/pkgs/by-name/op/opentofu/package.nix +++ b/pkgs/by-name/op/opentofu/package.nix @@ -15,16 +15,16 @@ let package = buildGoModule rec { pname = "opentofu"; - version = "1.8.6"; + version = "1.8.7"; src = fetchFromGitHub { owner = "opentofu"; repo = "opentofu"; rev = "v${version}"; - hash = "sha256-yJCUWRAntye3Dx2a+s/gNVa+XuCQak24TnFjSY+/3zc="; + hash = "sha256-OLXR9aA94KcIsZxk8gOZxZsljMKuymScuYcoj9W5Hj4="; }; - vendorHash = "sha256-MHdEY2nlUGTKybMPran5mTXlAlTFilfrY5K2sMlPe5U="; + vendorHash = "sha256-6M/uqwhNruIPx5srbimKuDJaFiZkyosoZQXWjxa6GxY="; ldflags = [ "-s" "-w"