From c3b6ef74172e384102441180fe95e90d39eb9bdc Mon Sep 17 00:00:00 2001 From: Victor Hang Date: Sun, 1 Sep 2024 01:50:23 +0200 Subject: [PATCH] netfetch: init at 5.2.10 Signed-off-by: Victor Hang --- maintainers/maintainer-list.nix | 6 ++++ pkgs/by-name/ne/netfetch/package.nix | 48 ++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 pkgs/by-name/ne/netfetch/package.nix diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 493e2848ddf0..efb9dea997ee 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -2255,6 +2255,12 @@ githubId = 80325; name = "Benjamin Andresen"; }; + banh-canh = { + email = "vhvictorhang@gmail.com"; + github = "Banh-Canh"; + githubId = 66330398; + name = "Victor Hang"; + }; barab-i = { email = "barab_i@outlook.com"; github = "barab-i"; diff --git a/pkgs/by-name/ne/netfetch/package.nix b/pkgs/by-name/ne/netfetch/package.nix new file mode 100644 index 000000000000..b262e03cca9c --- /dev/null +++ b/pkgs/by-name/ne/netfetch/package.nix @@ -0,0 +1,48 @@ +{ + lib, + buildGoModule, + fetchFromGitHub, + installShellFiles, + stdenv, +}: +buildGoModule rec { + pname = "netfetch"; + version = "5.2.10"; + + src = fetchFromGitHub { + owner = "deggja"; + repo = "netfetch"; + rev = "refs/tags/${version}"; + hash = "sha256-N3wKpWdG92cXH0TwAkcsld9TRrfPRkbw0uZY/X4d+xk="; + }; + + vendorHash = "sha256-/Em3hx5tiQjThLBPJDHGsqxUV3eXeymJ5pY9c601OW0="; + + proxyVendor = true; + + subPackages = [ "backend" ]; + + ldflags = [ + "-s" + "-w" + "-X github.com/deggja/netfetch/backend/cmd.Version=${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 ]; + }; +}