From 482ffcfacd1dabb87b883cf3deee6c8ed0871897 Mon Sep 17 00:00:00 2001 From: Moraxyc Date: Mon, 1 Apr 2024 03:26:30 +0800 Subject: [PATCH] nezha-agent: init at 0.16.3 --- pkgs/by-name/ne/nezha-agent/package.nix | 45 +++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 pkgs/by-name/ne/nezha-agent/package.nix diff --git a/pkgs/by-name/ne/nezha-agent/package.nix b/pkgs/by-name/ne/nezha-agent/package.nix new file mode 100644 index 000000000000..b9b43849d60a --- /dev/null +++ b/pkgs/by-name/ne/nezha-agent/package.nix @@ -0,0 +1,45 @@ +{ + lib, + buildGoModule, + fetchFromGitHub, + nezha-agent, + testers, +}: +buildGoModule rec { + pname = "nezha-agent"; + version = "0.16.3"; + + src = fetchFromGitHub { + owner = "nezhahq"; + repo = "agent"; + rev = "v${version}"; + hash = "sha256-DeZzR25KWxA70nS0mICaOb0TeBhnurm3FWLNS/EjwZA="; + }; + + vendorHash = "sha256-b8jICFsQaSetBzhTiq8zBX/LYuhQNly5kj45ZV6NDiY="; + + ldflags = [ + "-s" + "-w" + "-X main.version=${version}" + ]; + + # The test failed due to a geoip request in the sandbox. Remove it to avoid network requirement + preCheck = '' + rm ./pkg/monitor/myip_test.go + ''; + + passthru.tests = { + version = testers.testVersion { + package = nezha-agent; + command = "${nezha-agent}/bin/agent -v"; + }; + }; + + meta = with lib; { + description = "Agent of Nezha Monitoring"; + homepage = "https://github.com/nezhahq/agent"; + license = licenses.asl20; + maintainers = with maintainers; [moraxyc]; + }; +}