depot/third_party/nixpkgs/pkgs/by-name/te/terraform-plugin-docs/package.nix

62 lines
1.4 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitHub,
makeWrapper,
go,
testers,
terraform-plugin-docs,
nix-update-script,
}:
buildGoModule rec {
pname = "terraform-plugin-docs";
version = "0.20.1";
src = fetchFromGitHub {
owner = "hashicorp";
repo = "terraform-plugin-docs";
rev = "refs/tags/v${version}";
hash = "sha256-i5J0dBXqfm5YvELU8q5jLTtfgo8r1u/x/VW55TPmJLQ=";
};
vendorHash = "sha256-UmPbtLHy2PAGxDPo1NziHYpNifuI8lsYDASHyjVzGJo=";
nativeBuildInputs = [ makeWrapper ];
subPackages = [
"cmd/tfplugindocs"
];
allowGoReference = true;
CGO_ENABLED = 0;
ldflags = [
"-s"
"-w"
"-X main.version=${version}"
"-X main.commit=${src.rev}"
];
postInstall = ''
wrapProgram $out/bin/tfplugindocs --prefix PATH : ${lib.makeBinPath [ go ]}
'';
passthru = {
tests.version = testers.testVersion {
command = "tfplugindocs --version";
package = terraform-plugin-docs;
};
updateScript = nix-update-script { };
};
meta = with lib; {
description = "Generate and validate Terraform plugin/provider documentation";
homepage = "https://github.com/hashicorp/terraform-plugin-docs";
changelog = "https://github.com/hashicorp/terraform-plugin-docs/releases/tag/v${version}";
license = licenses.mpl20;
mainProgram = "tfplugindocs";
maintainers = with maintainers; [ lewo ];
};
}