Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 makeWrapper,
6 go,
7 testers,
8 terraform-plugin-docs,
9 nix-update-script,
10}:
11
12buildGoModule rec {
13 pname = "terraform-plugin-docs";
14 version = "0.22.0";
15
16 src = fetchFromGitHub {
17 owner = "hashicorp";
18 repo = "terraform-plugin-docs";
19 tag = "v${version}";
20 hash = "sha256-ktYADQEUD3bb6JRUy/g4l2J3XBzCVbt/knLqsd/MnF8=";
21 };
22
23 vendorHash = "sha256-FKIBkg2fXO89GDTkHQeK4v2YWe870GAKgNiu12k3iS0=";
24
25 nativeBuildInputs = [ makeWrapper ];
26
27 subPackages = [
28 "cmd/tfplugindocs"
29 ];
30
31 allowGoReference = true;
32
33 env.CGO_ENABLED = 0;
34
35 ldflags = [
36 "-s"
37 "-w"
38 "-X github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs/build.version=${version}"
39 "-X github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs/build.commit=${src.tag}"
40 ];
41
42 postInstall = ''
43 wrapProgram $out/bin/tfplugindocs --prefix PATH : ${lib.makeBinPath [ go ]}
44 '';
45
46 passthru = {
47 tests.version = testers.testVersion {
48 command = "tfplugindocs --version";
49 package = terraform-plugin-docs;
50 };
51 updateScript = nix-update-script { };
52 };
53
54 meta = {
55 description = "Generate and validate Terraform plugin/provider documentation";
56 homepage = "https://github.com/hashicorp/terraform-plugin-docs";
57 changelog = "https://github.com/hashicorp/terraform-plugin-docs/releases/tag/v${version}";
58 license = lib.licenses.mpl20;
59 mainProgram = "tfplugindocs";
60 maintainers = with lib.maintainers; [ lewo ];
61 };
62}