summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/ne/netfetch/package.nix
blob: f2b33edff450f99dfb6528a1e3a474b471c7c999 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
  lib,
  buildGoModule,
  fetchFromGitHub,
  installShellFiles,
  stdenv,
}:
buildGoModule (finalAttrs: {
  pname = "netfetch";
  version = "5.2.10";

  src = fetchFromGitHub {
    owner = "deggja";
    repo = "netfetch";
    tag = finalAttrs.version;
    hash = "sha256-N3wKpWdG92cXH0TwAkcsld9TRrfPRkbw0uZY/X4d+xk=";
  };

  vendorHash = "sha256-/Em3hx5tiQjThLBPJDHGsqxUV3eXeymJ5pY9c601OW0=";

  proxyVendor = true;

  subPackages = [ "backend" ];

  ldflags = [
    "-s"
    "-w"
    "-X github.com/deggja/netfetch/backend/cmd.Version=${finalAttrs.version}"
  ];

  nativeBuildInputs = [ installShellFiles ];

  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
    mv $out/bin/backend $out/bin/$pname
    installShellCompletion --cmd $pname \
      --bash <($out/bin/$pname completion bash) \
      --fish <($out/bin/$pname completion fish) \
      --zsh <($out/bin/$pname completion zsh)
  '';

  meta = {
    homepage = "https://github.com/deggja/netfetch";
    description = "Kubernetes tool for scanning clusters for network policies and identifying unprotected workloads";
    license = lib.licenses.mit;
    mainProgram = "netfetch";
    maintainers = with lib.maintainers; [ banh-canh ];
  };
})