From dafc80a06111c6e009b8641f4a1dd0c8b0b95c08 Mon Sep 17 00:00:00 2001 From: pacaroha <187338595+pacaroha@users.noreply.github.com> Date: Wed, 28 May 2025 09:45:43 -0700 Subject: [PATCH 1/3] tflint-plugins: allow unversioned references --- .../tools/analysis/tflint-plugins/tflint-ruleset-aws.nix | 7 +++++++ .../analysis/tflint-plugins/tflint-ruleset-google.nix | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/pkgs/development/tools/analysis/tflint-plugins/tflint-ruleset-aws.nix b/pkgs/development/tools/analysis/tflint-plugins/tflint-ruleset-aws.nix index 9564cc5ee7e0..48f9ecbf0abd 100644 --- a/pkgs/development/tools/analysis/tflint-plugins/tflint-ruleset-aws.nix +++ b/pkgs/development/tools/analysis/tflint-plugins/tflint-ruleset-aws.nix @@ -23,8 +23,15 @@ buildGoModule rec { ''; postInstall = '' + # allow use as a versioned dependency, i.e., with `source = ...` and + # `version = ...` in `.tflintrc`: mkdir -p $out/github.com/terraform-linters/${pname}/${version} mv $out/bin/${pname} $out/github.com/terraform-linters/${pname}/${version}/ + + # allow use as an unversioned dependency, e.g., if one wants `.tflintrc` to + # solely rely on Nix to pin versions: + ln -s $out/github.com/terraform-linters/${pname}/${version}/${pname} $out/ + # remove other binaries from bin rm -R $out/bin ''; diff --git a/pkgs/development/tools/analysis/tflint-plugins/tflint-ruleset-google.nix b/pkgs/development/tools/analysis/tflint-plugins/tflint-ruleset-google.nix index 16f654c5005b..e6854817823c 100644 --- a/pkgs/development/tools/analysis/tflint-plugins/tflint-ruleset-google.nix +++ b/pkgs/development/tools/analysis/tflint-plugins/tflint-ruleset-google.nix @@ -25,8 +25,14 @@ buildGoModule rec { subPackages = [ "." ]; postInstall = '' + # allow use as a versioned dependency, i.e., with `source = ...` and + # `version = ...` in `.tflintrc`: mkdir -p $out/github.com/terraform-linters/${pname}/${version} mv $out/bin/${pname} $out/github.com/terraform-linters/${pname}/${version}/ + + # allow use as an unversioned dependency, e.g., if one wants `.tflintrc` to + # solely rely on Nix to pin versions: + ln -s $out/github.com/terraform-linters/${pname}/${version}/${pname} $out/ ''; meta = with lib; { From b5cf84bb2d543cfc0c68183be5168c0418cb0349 Mon Sep 17 00:00:00 2001 From: pacaroha <187338595+pacaroha@users.noreply.github.com> Date: Wed, 28 May 2025 09:46:31 -0700 Subject: [PATCH 2/3] tflint-plugins.tflint-ruleset-aws: 0.37.0 -> 0.40.0 --- .../analysis/tflint-plugins/tflint-ruleset-aws.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/analysis/tflint-plugins/tflint-ruleset-aws.nix b/pkgs/development/tools/analysis/tflint-plugins/tflint-ruleset-aws.nix index 48f9ecbf0abd..a2b9721efd06 100644 --- a/pkgs/development/tools/analysis/tflint-plugins/tflint-ruleset-aws.nix +++ b/pkgs/development/tools/analysis/tflint-plugins/tflint-ruleset-aws.nix @@ -6,16 +6,21 @@ buildGoModule rec { pname = "tflint-ruleset-aws"; - version = "0.37.0"; + version = "0.40.0"; src = fetchFromGitHub { owner = "terraform-linters"; repo = pname; rev = "v${version}"; - hash = "sha256-7xS1V7Ec3eWiVjMB/4MLeKlGxNKRYeHVFc61dpoBU/8="; + hash = "sha256-n8o43zCZWrTmLdEuCPe9B1lqxnCbytwRUXSof2sI1Zw="; }; - vendorHash = "sha256-XUGcRky0GMV2RSahUk6k/KWkWvxdCLi/7TpXn2MdNoM="; + vendorHash = "sha256-PBXObv/9QwWPmLnTReV7iuFyas1RFtvlboEjPfyIi7w="; + + postPatch = '' + # some automation for creating new releases on GitHub, which we don't need + rm -rf tools/release + ''; # upstream Makefile also does a go test $(go list ./... | grep -v integration) preCheck = '' From e0df176a92f1a2bf439d10610cf4b1f3e45578f5 Mon Sep 17 00:00:00 2001 From: pacaroha <187338595+pacaroha@users.noreply.github.com> Date: Wed, 28 May 2025 10:05:36 -0700 Subject: [PATCH 3/3] tflint: add version metadata to tflint.withPlugins --- pkgs/by-name/tf/tflint/package.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/tf/tflint/package.nix b/pkgs/by-name/tf/tflint/package.nix index 5f586cac6606..91451a5f3a35 100644 --- a/pkgs/by-name/tf/tflint/package.nix +++ b/pkgs/by-name/tf/tflint/package.nix @@ -43,9 +43,10 @@ buildGoModule { paths = [ actualPlugins ]; }; in - runCommand "tflint-with-plugins" + runCommand "tflint-with-plugins-${version}" { nativeBuildInputs = [ makeWrapper ]; + inherit version; } '' makeWrapper ${tflint}/bin/tflint $out/bin/tflint \