Commit 9fa1a45d authored by kyehn's avatar kyehn
Browse files

tflint: add versionCheckHook

parent ed8c7e0a
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
  lib,
  buildGo125Module,
  fetchFromGitHub,
  versionCheckHook,
  runCommand,
  makeWrapper,
  tflint,
@@ -9,17 +10,14 @@
  symlinkJoin,
}:

let
buildGo125Module (finalAttrs: {
  pname = "tflint";
  version = "0.59.1";
in
buildGo125Module {
  inherit pname version;

  src = fetchFromGitHub {
    owner = "terraform-linters";
    repo = "tflint";
    tag = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-tE8h0sAKCJEZzZqUAcgyVWVRXdG3F7F1Vh7Je0+0Xeg=";
  };

@@ -34,6 +32,12 @@ buildGo125Module {
    "-w"
  ];

  doInstallCheck = true;

  nativeInstallCheckInputs = [ versionCheckHook ];

  versionCheckProgramArg = "--version";

  passthru.withPlugins =
    plugins:
    let
@@ -43,10 +47,10 @@ buildGo125Module {
        paths = [ actualPlugins ];
      };
    in
    runCommand "tflint-with-plugins-${version}"
    runCommand "tflint-with-plugins-${finalAttrs.version}"
      {
        nativeBuildInputs = [ makeWrapper ];
        inherit version;
        inherit (finalAttrs) version;
      }
      ''
        makeWrapper ${tflint}/bin/tflint $out/bin/tflint \
@@ -57,8 +61,8 @@ buildGo125Module {
    description = "Terraform linter focused on possible errors, best practices, and so on";
    mainProgram = "tflint";
    homepage = "https://github.com/terraform-linters/tflint";
    changelog = "https://github.com/terraform-linters/tflint/blob/v${version}/CHANGELOG.md";
    changelog = "https://github.com/terraform-linters/tflint/blob/v${finalAttrs.version}/CHANGELOG.md";
    license = lib.licenses.mpl20;
    maintainers = with lib.maintainers; [ momeemt ];
  };
}
})