biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / tools / misc / diffoci / default.nix
blobb2142cfc227e438d0bae70980587891bbf1a6490
1 { lib
2 , stdenv
3 , buildPackages
4 , buildGoModule
5 , fetchFromGitHub
6 , installShellFiles
7 }:
9 buildGoModule rec {
10   pname = "diffoci";
11   version = "0.1.5";
13   src = fetchFromGitHub {
14     owner = "reproducible-containers";
15     repo = "diffoci";
16     rev = "v${version}";
17     hash = "sha256-ZVWnfg5uWYuqsNd4X6t1gWBGMfdcirSp7QZZDhqAfaI=";
18   };
20   vendorHash = "sha256-qb4HvK4UbJbtP/ypeptV/MMbhOu5UZDaGartq/RGpDM=";
22   ldflags = [
23     "-s"
24     "-w"
25     "-X=github.com/reproducible-containers/diffoci/cmd/diffoci/version.Version=v${version}"
26   ];
28   nativeBuildInputs = [ installShellFiles ];
30   postInstall =
31     let
32       diffoci = if stdenv.buildPlatform.canExecute stdenv.hostPlatform then placeholder "out" else buildPackages.diffoci;
33     in
34     ''
35       installShellCompletion --cmd trivy \
36         --bash <(${diffoci}/bin/diffoci completion bash) \
37         --fish <(${diffoci}/bin/diffoci completion fish) \
38         --zsh <(${diffoci}/bin/diffoci completion zsh)
39     '';
41   meta = with lib; {
42     description = "Diff for Docker and OCI container images";
43     homepage = "https://github.com/reproducible-containers/diffoci/";
44     license = licenses.asl20;
45     maintainers = with maintainers; [ jk ];
46     mainProgram = "diffoci";
47   };