nezha-agent: 0.18.5 -> 0.20.2 (#347544)
This commit is contained in:
commit
ef5045c670
@ -31,6 +31,20 @@ in
|
||||
Enable GPU monitoring.
|
||||
'';
|
||||
};
|
||||
temperature = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Enable temperature monitoring.
|
||||
'';
|
||||
};
|
||||
useIPv6CountryCode = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Use ipv6 countrycode to report location.
|
||||
'';
|
||||
};
|
||||
disableCommandExecute = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
@ -96,7 +110,7 @@ in
|
||||
startLimitBurst = 3;
|
||||
script = lib.concatStringsSep " " (
|
||||
[
|
||||
"${cfg.package}/bin/agent"
|
||||
"${lib.getExe cfg.package}"
|
||||
"--disable-auto-update"
|
||||
"--disable-force-update"
|
||||
"--password $(cat ${cfg.passwordFile})"
|
||||
@ -109,6 +123,8 @@ in
|
||||
++ lib.optional cfg.skipProcess "--skip-procs"
|
||||
++ lib.optional cfg.tls "--tls"
|
||||
++ lib.optional cfg.gpu "--gpu"
|
||||
++ lib.optional cfg.temperature "--temperature"
|
||||
++ lib.optional cfg.useIPv6CountryCode "--use-ipv6-countrycode"
|
||||
);
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
|
@ -1,45 +1,66 @@
|
||||
{
|
||||
lib,
|
||||
buildGoModule,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
nezha-agent,
|
||||
versionCheckHook,
|
||||
testers,
|
||||
}:
|
||||
buildGoModule rec {
|
||||
pname = "nezha-agent";
|
||||
version = "0.18.5";
|
||||
version = "0.20.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nezhahq";
|
||||
repo = "agent";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-LmWfs3aL+1lsX4ix2FjDP5g+A0wgcfziXdw5SaKlAdk=";
|
||||
hash = "sha256-BM3FhCf9zfccC2xC/Fhz2/andZmPYsJojMRUA3M9NOQ=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-frPAhiexFSt+KobMbf32h8xv7HMcPl5koEgSs8Nz3cs=";
|
||||
vendorHash = "sha256-q6/265vVg6jCnDvs825nni8QFHkJpQz4xxC9MlJH2do=";
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X main.version=${version}"
|
||||
"-X main.arch=${stdenv.hostPlatform.system}"
|
||||
];
|
||||
|
||||
# The test failed due to a geoip request in the sandbox. Remove it to avoid network requirement
|
||||
preCheck = ''
|
||||
rm ./pkg/monitor/myip_test.go
|
||||
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
|
||||
'';
|
||||
|
||||
passthru.tests = {
|
||||
version = testers.testVersion {
|
||||
package = nezha-agent;
|
||||
command = "${nezha-agent}/bin/agent -v";
|
||||
};
|
||||
};
|
||||
doInstallCheck = true;
|
||||
|
||||
versionCheckProgramArg = "-v";
|
||||
|
||||
nativeInstallCheckInputs = [
|
||||
versionCheckHook
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Agent of Nezha Monitoring";
|
||||
homepage = "https://github.com/nezhahq/agent";
|
||||
license = lib.licenses.asl20;
|
||||
maintainers = with lib.maintainers; [ moraxyc ];
|
||||
mainProgram = "nezha-agent";
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user