From 3f34ba46d6e6aba733af0e3392a964f3bfa0e409 Mon Sep 17 00:00:00 2001 From: Moraxyc Date: Sun, 24 Nov 2024 17:47:28 +0800 Subject: [PATCH 1/3] nezha-agent: add updateScript --- pkgs/by-name/ne/nezha-agent/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/ne/nezha-agent/package.nix b/pkgs/by-name/ne/nezha-agent/package.nix index 750e1ecdaf2f..4b2699f879c6 100644 --- a/pkgs/by-name/ne/nezha-agent/package.nix +++ b/pkgs/by-name/ne/nezha-agent/package.nix @@ -4,6 +4,7 @@ stdenv, fetchFromGitHub, versionCheckHook, + nix-update-script, }: buildGoModule rec { pname = "nezha-agent"; @@ -54,6 +55,10 @@ buildGoModule rec { versionCheckHook ]; + passthru = { + updateScript = nix-update-script { }; + }; + meta = { description = "Agent of Nezha Monitoring"; homepage = "https://github.com/nezhahq/agent"; From 78c80ec3842f9ba71dae7e383709a4d57f0f7165 Mon Sep 17 00:00:00 2001 From: Moraxyc Date: Sun, 24 Nov 2024 17:48:43 +0800 Subject: [PATCH 2/3] nezha-agent: 0.20.3 -> 0.20.5 Diff: https://github.com/nezhahq/agent/compare/refs/tags/v0.20.3...v0.20.5 --- pkgs/by-name/ne/nezha-agent/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/ne/nezha-agent/package.nix b/pkgs/by-name/ne/nezha-agent/package.nix index 4b2699f879c6..5641cff73012 100644 --- a/pkgs/by-name/ne/nezha-agent/package.nix +++ b/pkgs/by-name/ne/nezha-agent/package.nix @@ -8,16 +8,16 @@ }: buildGoModule rec { pname = "nezha-agent"; - version = "0.20.3"; + version = "0.20.5"; src = fetchFromGitHub { owner = "nezhahq"; repo = "agent"; rev = "refs/tags/v${version}"; - hash = "sha256-cLLiJbAr7TxVUNV31Y9TG8ZL4uqBCOnrOr1FM4+1U5c="; + hash = "sha256-CVE1c0LLheGlH8oMWQWs6fox7mlHc5Y2O9XQ6kqXAwI="; }; - vendorHash = "sha256-q6/265vVg6jCnDvs825nni8QFHkJpQz4xxC9MlJH2do="; + vendorHash = "sha256-ytFsTHl6kVwmqCabaMDxxijszY3jzWWUIZKBCebPMkI="; ldflags = [ "-s" From b84c7c214ee16d46d41ce0097455d26a2eb222a6 Mon Sep 17 00:00:00 2001 From: Moraxyc Date: Sun, 24 Nov 2024 17:57:42 +0800 Subject: [PATCH 3/3] nixos/nezha-agent: add options for new features - servives.nezha-agent.disableNat: Disable NAT penetration - servives.nezha-agent.disableSendQuery: Disable sending TCP/ICMP/HTTP requests --- .../modules/services/monitoring/nezha-agent.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/nixos/modules/services/monitoring/nezha-agent.nix b/nixos/modules/services/monitoring/nezha-agent.nix index e51328e48795..035485a939b8 100644 --- a/nixos/modules/services/monitoring/nezha-agent.nix +++ b/nixos/modules/services/monitoring/nezha-agent.nix @@ -52,6 +52,20 @@ in Disable executing the command from dashboard. ''; }; + disableNat = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Disable NAT penetration. + ''; + }; + disableSendQuery = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Disable sending TCP/ICMP/HTTP requests. + ''; + }; skipConnection = lib.mkOption { type = lib.types.bool; default = false; @@ -125,6 +139,8 @@ in ] ++ lib.optional cfg.debug "--debug" ++ lib.optional cfg.disableCommandExecute "--disable-command-execute" + ++ lib.optional cfg.disableNat "--disable-nat" + ++ lib.optional cfg.disableSendQuery "--disable-send-query" ++ lib.optional (cfg.reportDelay != null) "--report-delay ${toString cfg.reportDelay}" ++ lib.optional (cfg.server != null) "--server ${cfg.server}" ++ lib.optional cfg.skipConnection "--skip-conn"