Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6 stdenv,
7}:
8buildGoModule rec {
9 pname = "netfetch";
10 version = "5.2.10";
11
12 src = fetchFromGitHub {
13 owner = "deggja";
14 repo = "netfetch";
15 tag = version;
16 hash = "sha256-N3wKpWdG92cXH0TwAkcsld9TRrfPRkbw0uZY/X4d+xk=";
17 };
18
19 vendorHash = "sha256-/Em3hx5tiQjThLBPJDHGsqxUV3eXeymJ5pY9c601OW0=";
20
21 proxyVendor = true;
22
23 subPackages = [ "backend" ];
24
25 ldflags = [
26 "-s"
27 "-w"
28 "-X github.com/deggja/netfetch/backend/cmd.Version=${version}"
29 ];
30
31 nativeBuildInputs = [ installShellFiles ];
32
33 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
34 mv $out/bin/backend $out/bin/$pname
35 installShellCompletion --cmd $pname \
36 --bash <($out/bin/$pname completion bash) \
37 --fish <($out/bin/$pname completion fish) \
38 --zsh <($out/bin/$pname completion zsh)
39 '';
40
41 meta = {
42 homepage = "https://github.com/deggja/netfetch";
43 description = "Kubernetes tool for scanning clusters for network policies and identifying unprotected workloads";
44 license = lib.licenses.mit;
45 mainProgram = "netfetch";
46 maintainers = with lib.maintainers; [ banh-canh ];
47 };
48}