preload: init at 0.6.4
[NixPkgs.git] / pkgs / by-name / te / terraform-plugin-docs / package.nix
blobde64c81093c55bb6e8577e8998ebe32eefab3dd8
1 { lib
2 , buildGoModule
3 , fetchFromGitHub
4 , makeWrapper
5 , go
6 , testers
7 , terraform-plugin-docs
8 , nix-update-script
9 }:
11 buildGoModule rec {
12   pname = "terraform-plugin-docs";
13   version = "0.16.0";
15   src = fetchFromGitHub {
16     owner = "hashicorp";
17     repo = "terraform-plugin-docs";
18     rev = "refs/tags/v${version}";
19     sha256 = "sha256-5vbi69GMgkzvN3aEQbNTbk99rg+kfvAvUrdDsuyIm9s=";
20   };
22   vendorHash = "sha256-AjW6BokLVDkIWXToJ7wNq/g19xKTAfpQ/gVlKCV5qw0=";
24   nativeBuildInputs = [ makeWrapper ];
26   subPackages = [
27     "cmd/tfplugindocs"
28   ];
30   allowGoReference = true;
32   CGO_ENABLED = 0;
34   ldflags = [
35     "-s"
36     "-w"
37     "-X main.version=${version}"
38     "-X main.commit=${src.rev}"
39   ];
41   postInstall = ''
42     wrapProgram $out/bin/tfplugindocs --prefix PATH : ${lib.makeBinPath [ go ]}
43   '';
45   passthru = {
46     tests.version = testers.testVersion {
47       command = "tfplugindocs --version";
48       package = terraform-plugin-docs;
49     };
50     updateScript = nix-update-script { };
51   };
53   meta = with lib; {
54     description = "Generate and validate Terraform plugin/provider documentation";
55     homepage = "https://github.com/hashicorp/terraform-plugin-docs";
56     changelog = "https://github.com/hashicorp/terraform-plugin-docs/releases/tag/v${version}";
57     license = licenses.mpl20;
58     mainProgram = "tfplugindocs";
59     maintainers = with maintainers; [ lewo ];
60   };