diff --git a/pkgs/by-name/tf/tflint/package.nix b/pkgs/by-name/tf/tflint/package.nix index 2b378148d409..2ca672dc742b 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 \ 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..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 = '' @@ -23,8 +28,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; {