Files
nixpkgs/pkgs/by-name/ne/nezha-agent/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

69 lines
1.4 KiB
Nix

{
lib,
buildGoModule,
stdenv,
fetchFromGitHub,
versionCheckHook,
nix-update-script,
}:
buildGoModule (finalAttrs: {
pname = "nezha-agent";
version = "1.13.1";
src = fetchFromGitHub {
owner = "nezhahq";
repo = "agent";
tag = "v${finalAttrs.version}";
hash = "sha256-csV03eYbXchIJb/ZNAaCKt2SCcO7ugpt9jspvYDiJm0=";
};
vendorHash = "sha256-5g2AgkqaelCD10dxwcEmBLYy5nrd4IALiss0dTrTTno=";
ldflags = [
"-s"
"-X github.com/nezhahq/agent/pkg/monitor.Version=${finalAttrs.version}"
"-X main.arch=${stdenv.hostPlatform.system}"
];
checkFlags =
let
# Skip tests that require network access
skippedTests = [
"TestLookupIP"
"TestGeoIPApi"
"TestFetchGeoIP"
"TestCloudflareDetection"
];
in
[ "-skip=^${builtins.concatStringsSep "$|^" skippedTests}$" ];
postInstall = ''
pushd $out/bin
mv agent nezha-agent
# for compatibility
ln -sr nezha-agent agent
popd
'';
doInstallCheck = true;
versionCheckProgramArg = "-v";
nativeInstallCheckInputs = [
versionCheckHook
];
passthru = {
updateScript = nix-update-script { };
};
meta = {
description = "Agent of Nezha Monitoring";
homepage = "https://github.com/nezhahq/agent";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ moraxyc ];
mainProgram = "nezha-agent";
};
})