From cba1e458a84949a0e5324f00ecf2e3feeb15afa2 Mon Sep 17 00:00:00 2001 From: Nikita Pedorich Date: Sat, 22 Jun 2024 10:27:50 +0900 Subject: [PATCH] netdata: 1.45.4 -> 1.46.1 --- nixos/modules/services/monitoring/netdata.nix | 3 ++- .../system/netdata/dashboard-v2-removal.patch | 25 ++++++++++++++++++ pkgs/tools/system/netdata/default.nix | 26 +++++++------------ .../system/netdata/ndsudo-fix-path.patch | 16 ++++++++++++ 4 files changed, 53 insertions(+), 17 deletions(-) create mode 100644 pkgs/tools/system/netdata/dashboard-v2-removal.patch create mode 100644 pkgs/tools/system/netdata/ndsudo-fix-path.patch diff --git a/nixos/modules/services/monitoring/netdata.nix b/nixos/modules/services/monitoring/netdata.nix index 8f89408bdea5..c47da2cc075d 100644 --- a/nixos/modules/services/monitoring/netdata.nix +++ b/nixos/modules/services/monitoring/netdata.nix @@ -247,7 +247,8 @@ in { ++ lib.optional cfg.python.enable (pkgs.python3.withPackages cfg.python.extraPackages) ++ lib.optional config.virtualisation.libvirtd.enable config.virtualisation.libvirtd.package ++ lib.optional config.virtualisation.docker.enable config.virtualisation.docker.package - ++ lib.optionals config.virtualisation.podman.enable [ pkgs.jq config.virtualisation.podman.package ]; + ++ lib.optionals config.virtualisation.podman.enable [ pkgs.jq config.virtualisation.podman.package ] + ++ lib.optional config.boot.zfs.enabled config.boot.zfs.package; environment = { PYTHONPATH = "${cfg.package}/libexec/netdata/python.d/python_modules"; NETDATA_PIPENAME = "/run/netdata/ipc"; diff --git a/pkgs/tools/system/netdata/dashboard-v2-removal.patch b/pkgs/tools/system/netdata/dashboard-v2-removal.patch new file mode 100644 index 000000000000..5eb7ef62eeb0 --- /dev/null +++ b/pkgs/tools/system/netdata/dashboard-v2-removal.patch @@ -0,0 +1,25 @@ +# Original: https://github.com/netdata/netdata/pull/17240 + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f37cbd18a..6db4c9f52 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -134,6 +134,7 @@ mark_as_advanced(DEFAULT_FEATURE_STATE) + # High-level features + option(ENABLE_ACLK "Enable Netdata Cloud support (ACLK)" ${DEFAULT_FEATURE_STATE}) + option(ENABLE_CLOUD "Enable Netdata Cloud by default at runtime" ${DEFAULT_FEATURE_STATE}) ++option(ENABLE_DASHBOARD_V2 "enable dashboard v2" True) + option(ENABLE_ML "Enable machine learning features" ${DEFAULT_FEATURE_STATE}) + option(ENABLE_DBENGINE "Enable dbengine metrics storage" True) + +@@ -2946,7 +2947,9 @@ endif() + # + + include(src/web/gui/v1/dashboard_v1.cmake) +-include(src/web/gui/v2/dashboard_v2.cmake) ++if(ENABLE_DASHBOARD_V2) ++ include(src/web/gui/v2/dashboard_v2.cmake) ++endif() + include(src/web/gui/gui.cmake) + + function(cat IN_FILE OUT_FILE) \ No newline at end of file diff --git a/pkgs/tools/system/netdata/default.nix b/pkgs/tools/system/netdata/default.nix index 9ddba232de19..936b7ec9926d 100644 --- a/pkgs/tools/system/netdata/default.nix +++ b/pkgs/tools/system/netdata/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake, pkg-config, makeWrapper +{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, makeWrapper , CoreFoundation, IOKit, libossp_uuid , nixosTests , bash, curl, jemalloc, json_c, libuv, zlib, libyaml, libelf, libbpf @@ -20,7 +20,7 @@ }: stdenv.mkDerivation rec { - version = "1.45.4"; + version = "1.46.1"; pname = "netdata"; src = fetchFromGitHub { @@ -28,9 +28,9 @@ stdenv.mkDerivation rec { repo = "netdata"; rev = "v${version}"; hash = if withCloudUi - then "sha256-g/wxKtpNsDw/ZaUokdip39enQHMysJE6pYGsApuL4po=" + then "sha256-tFjczhJ7bIEUDZx3MxYBu4tGkJhoQn5V79D4sLV2o8U=" # we delete the v2 GUI after fetching - else "sha256-Mkrmvdr19sWzFOkdpt46mcsbA3CNpXy4w8um95xaWlo="; + else "sha256-uW3jRiJjFIFSfmmavM3KVF985F8nMKa+lQAgNBZvKyE="; fetchSubmodules = true; # Remove v2 dashboard distributed under NCUL1. Make sure an empty @@ -60,18 +60,12 @@ stdenv.mkDerivation rec { ++ lib.optionals withSsl [ openssl ]; patches = [ + # Allow ndsudo to use non-hardcoded `PATH` + # See https://github.com/netdata/netdata/pull/17377#issuecomment-2183017868 + # https://github.com/netdata/netdata/security/advisories/GHSA-pmhq-4cxq-wj93 + ./ndsudo-fix-path.patch # Allow building without non-free v2 dashboard. - (fetchpatch { - url = "https://github.com/netdata/netdata/pull/17240/commits/b108df72281633234b731b223d99ec99f1d36adf.patch"; - hash = "sha256-tgsnbNY0pxFU3bz1J1qPaAeVsozsk2bpHV2mNy8A9is="; - }) - # Allow for go.d plugins to access the right directory. - # Can be removed once > v1.45.4 is released - # https://github.com/netdata/netdata/pull/17661 - (fetchpatch { - url = "https://patch-diff.githubusercontent.com/raw/netdata/netdata/pull/17661.patch"; - sha256 = "sha256-j+mrwkibQio2KO8UnV7sxzCoHmkcsalHNzP+YvrRz74="; - }) + ./dashboard-v2-removal.patch ]; # Guard against unused buld-time development inputs in closure. Without @@ -186,7 +180,7 @@ stdenv.mkDerivation rec { sourceRoot = "${src.name}/src/go/collectors/go.d.plugin"; - vendorHash = "sha256-KO+xMk6fpZCYRyxxKrsGfOHJ2bwjBaSmkgz1jIUHaZs="; + vendorHash = "sha256-fK6pboXgJom77iakb+CJvNuweQjLIrpS7suWRNY/KM4="; doCheck = false; proxyVendor = true; diff --git a/pkgs/tools/system/netdata/ndsudo-fix-path.patch b/pkgs/tools/system/netdata/ndsudo-fix-path.patch new file mode 100644 index 000000000000..04087e54a00a --- /dev/null +++ b/pkgs/tools/system/netdata/ndsudo-fix-path.patch @@ -0,0 +1,16 @@ +# See https://github.com/netdata/netdata/pull/17377#issuecomment-2183017868 +# https://github.com/netdata/netdata/security/advisories/GHSA-pmhq-4cxq-wj93 + +diff --git a/src/collectors/plugins.d/ndsudo.c b/src/collectors/plugins.d/ndsudo.c +index 8b4d76f46..68fa52d38 100644 +--- a/src/collectors/plugins.d/ndsudo.c ++++ b/src/collectors/plugins.d/ndsudo.c +@@ -357,9 +357,6 @@ int main(int argc, char *argv[]) { + return 3; + } + +- char new_path[] = "PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"; +- putenv(new_path); +- + bool found = false; + char filename[FILENAME_MAX]; \ No newline at end of file