ripasso-cursive: cosmetic changes (#361736)
[NixPkgs.git] / pkgs / by-name / k8 / k8s-manifest-sigstore / package.nix
blob17c12ad9e415aabe9bb805283ec279511acfe128
2   lib,
3   buildGoModule,
4   fetchFromGitHub,
5   installShellFiles,
6   testers,
7   k8s-manifest-sigstore,
8   gitUpdater,
9 }:
11 buildGoModule rec {
12   pname = "k8s-manifest-sigstore";
13   version = "0.5.4";
15   src = fetchFromGitHub {
16     owner = "sigstore";
17     repo = pname;
18     rev = "v${version}";
19     hash = "sha256-BDBkPXDg9DruIt5f7RrpStFeuTGiOOpsb6JiKaCTOOk=";
20   };
22   nativeBuildInputs = [ installShellFiles ];
24   vendorHash = "sha256-dIReCe+Qoq/chBrd/X5s4hucuDquvd7OTUSj0WpcIDE=";
26   subPackages = [ "cmd/kubectl-sigstore" ];
28   ldflags =
29     let
30       prefix = "github.com/sigstore/k8s-manifest-sigstore/pkg/util";
31     in
32     [
33       "-s"
34       "-w"
35       # https://github.com/sigstore/k8s-manifest-sigstore/blob/e740581a4652dd44eb65495ed071fd0258dcbeb4/Makefile#L22
36       "-X ${prefix}.buildDate=1970-01-01T00:00:00Z"
37       "-X ${prefix}.gitCommit=v${version}"
38       "-X ${prefix}.gitTreeState=clean"
39       "-X ${prefix}.GitVersion=v${version}"
40     ];
42   postInstall = ''
43     installShellCompletion --cmd kubectl-sigstore \
44       --bash <($out/bin/kubectl-sigstore completion bash) \
45       --fish <($out/bin/kubectl-sigstore completion fish) \
46       --zsh <($out/bin/kubectl-sigstore completion zsh)
47   '';
49   passthru = {
50     updateScript = gitUpdater { rev-prefix = "v"; };
51     tests.version = testers.testVersion {
52       package = k8s-manifest-sigstore;
53       command = "kubectl-sigstore version";
54       version = "v${version}";
55     };
56   };
58   meta = with lib; {
59     homepage = "https://github.com/sigstore/k8s-manifest-sigstore";
60     changelog = "https://github.com/sigstore/k8s-manifest-sigstore/releases/tag/v${version}";
61     description = "Kubectl plugin for signing Kubernetes manifest YAML files with sigstore";
62     mainProgram = "kubectl-sigstore";
63     license = licenses.asl20;
64     maintainers = with maintainers; [ bbigras ];
65   };