diff --git a/lib/licenses.nix b/lib/licenses.nix index 615a6b388153..efd38f47978b 100644 --- a/lib/licenses.nix +++ b/lib/licenses.nix @@ -845,6 +845,14 @@ in mkLicense lset) ({ fullName = "University of Illinois/NCSA Open Source License"; }; + ncul1 = { + spdxId = "NCUL1"; + fullName = "Netdata Cloud UI License v1.0"; + free = false; + redistributable = true; # Only if used in Netdata products. + url = "https://raw.githubusercontent.com/netdata/netdata/master/web/gui/v2/LICENSE.md"; + }; + nlpl = { spdxId = "NLPL"; fullName = "No Limit Public License"; 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 ]; };