about summary refs log tree commit diff
path: root/pkgs/tools/system/netdata
diff options
context:
space:
mode:
authorRatchanan Srirattanamet <peathot@hotmail.com>2023-09-25 04:19:12 +0700
committerRatchanan Srirattanamet <peathot@hotmail.com>2023-09-24 21:51:09 +0000
commit20b83a46d62422b7070035a32ae23cce408d4034 (patch)
tree569ea53e7ae34d7b91a96ad8a56ad71d5f9e0e72 /pkgs/tools/system/netdata
parent774c35c2a1bc4a9fa8e748ea69fe236cac0ec899 (diff)
downloadnixlib-20b83a46d62422b7070035a32ae23cce408d4034.tar
nixlib-20b83a46d62422b7070035a32ae23cce408d4034.tar.gz
nixlib-20b83a46d62422b7070035a32ae23cce408d4034.tar.bz2
nixlib-20b83a46d62422b7070035a32ae23cce408d4034.tar.lz
nixlib-20b83a46d62422b7070035a32ae23cce408d4034.tar.xz
nixlib-20b83a46d62422b7070035a32ae23cce408d4034.tar.zst
nixlib-20b83a46d62422b7070035a32ae23cce408d4034.zip
netdata: disable installation of non-free v2 dashboard
The v2 dashboard (included since version 1.41.0) is licensed under
Netdata Cloud UI License v1.0, which is a non-free license.

Patch the source code so that the v2 is not included in the source
and the result derivation. Users that want the v2 dashboard can still
request it by overriding this derivation and pass `withCloudUi = true`.

Co-authored-by: Raito Bezarius <masterancpp@gmail.com>
Fixes: https://github.com/NixOS/nixpkgs/issues/256964
Diffstat (limited to 'pkgs/tools/system/netdata')
-rw-r--r--pkgs/tools/system/netdata/default.nix25
1 files changed, 22 insertions, 3 deletions
diff --git a/pkgs/tools/system/netdata/default.nix b/pkgs/tools/system/netdata/default.nix
index e3dbabe1f52e..f380bf4fd6f6 100644
--- a/pkgs/tools/system/netdata/default.nix
+++ b/pkgs/tools/system/netdata/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchFromGitHub, autoreconfHook, pkg-config, makeWrapper
+{ lib, stdenv, fetchFromGitHub, fetchpatch, autoreconfHook, pkg-config, makeWrapper
 , CoreFoundation, IOKit, libossp_uuid
 , nixosTests
 , netdata-go-plugins
@@ -9,6 +9,7 @@
 , withIpmi ? (!stdenv.isDarwin), freeipmi
 , withNetfilter ? (!stdenv.isDarwin), libmnl, libnetfilter_acct
 , withCloud ? (!stdenv.isDarwin), json_c
+, withCloudUi ? false
 , withConnPubSub ? false, google-cloud-cpp, grpc
 , withConnPrometheus ? false, snappy
 , withSsl ? true, openssl
@@ -24,8 +25,17 @@ stdenv.mkDerivation rec {
     owner = "netdata";
     repo = "netdata";
     rev = "v${version}";
-    hash = "sha256-8L8PhPgNIHvw+Dcx2D6OE8fp2+GEYOc9wEIoPJSqXME=";
+    hash = if withCloudUi
+      then "sha256-8L8PhPgNIHvw+Dcx2D6OE8fp2+GEYOc9wEIoPJSqXME="
+      else "sha256-J/pKKxTNoSwvsyVaRsnazQQqu2C8zx1QEAkB+gkR5lU=";
     fetchSubmodules = true;
+
+    # Remove v2 dashboard distributed under NCUL1. Make sure an empty
+    # Makefile.am exists, as autoreconf will get confused otherwise.
+    postFetch = lib.optionalString (!withCloudUi) ''
+      rm -rf $out/web/gui/v2/*
+      touch $out/web/gui/v2/Makefile.am
+    '';
   };
 
   strictDeps = true;
@@ -53,6 +63,12 @@ stdenv.mkDerivation rec {
     # Avoid build-only inputs in closure leaked by configure command:
     #   https://github.com/NixOS/nixpkgs/issues/175693#issuecomment-1143344162
     ./skip-CONFIGURE_COMMAND.patch
+
+    # Allow building without non-free v2 dashboard.
+    (fetchpatch {
+      url = "https://github.com/peat-psuwit/netdata/commit/6ccbdd1500db2b205923968688d5f1777430a326.patch";
+      hash = "sha256-jAyk5HlxdjFn5IP6jOKP8/SXOraMQSA6r1krThe+s7g=";
+    })
   ];
 
   # Guard against unused buld-time development inputs in closure. Without
@@ -98,6 +114,8 @@ stdenv.mkDerivation rec {
     "--disable-dbengine"
   ] ++ lib.optionals (!withCloud) [
     "--disable-cloud"
+  ] ++ lib.optionals (!withCloudUi) [
+    "--disable-cloud-ui"
   ];
 
   postFixup = ''
@@ -118,7 +136,8 @@ stdenv.mkDerivation rec {
     description = "Real-time performance monitoring tool";
     homepage = "https://www.netdata.cloud/";
     changelog = "https://github.com/netdata/netdata/releases/tag/v${version}";
-    license = licenses.gpl3Plus;
+    license = [ licenses.gpl3Plus ]
+      ++ lib.optionals (withCloudUi) [ licenses.ncul1 ];
     platforms = platforms.unix;
     maintainers = with maintainers; [ raitobezarius ];
   };