depot/third_party/nixpkgs/pkgs/development/tools/analysis/tflint/default.nix
Default email 92b3d6365d Project import generated by Copybara.
GitOrigin-RevId: 412b9917cea092f3d39f9cd5dead4effd5bc4053
2022-10-30 16:09:59 +01:00

53 lines
1.2 KiB
Nix

{ lib
, buildGoModule
, fetchFromGitHub
, runCommand
, makeWrapper
, tflint
, tflint-plugins
, symlinkJoin
}:
buildGoModule rec {
pname = "tflint";
version = "0.42.2";
src = fetchFromGitHub {
owner = "terraform-linters";
repo = pname;
rev = "v${version}";
sha256 = "sha256-hlmIf8VD8LUxHrhEephw1e+RK6e+Jdf1HvhHu6bZxco=";
};
vendorSha256 = "sha256-KDXS/YWuA83MeBF6rXn3zm0oIHWJaxhdQazD2kRR0mM=";
doCheck = false;
subPackages = [ "." ];
ldflags = [ "-s" "-w" ];
passthru.withPlugins = plugins:
let
actualPlugins = plugins tflint-plugins;
pluginDir = symlinkJoin {
name = "tflint-plugin-dir";
paths = [ actualPlugins ];
};
in
runCommand "tflint-with-plugins"
{
nativeBuildInputs = [ makeWrapper ];
} ''
makeWrapper ${tflint}/bin/tflint $out/bin/tflint \
--set TFLINT_PLUGIN_DIR "${pluginDir}"
'';
meta = with lib; {
description = "Terraform linter focused on possible errors, best practices, and so on";
homepage = "https://github.com/terraform-linters/tflint";
changelog = "https://github.com/terraform-linters/tflint/raw/v${version}/CHANGELOG.md";
license = licenses.mpl20;
maintainers = [ maintainers.marsam ];
};
}