about summary refs log tree commit diff
path: root/pkgs/tools/system/netdata
diff options
context:
space:
mode:
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 ];
   };