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
This commit is contained in:
Ratchanan Srirattanamet 2023-09-25 04:19:12 +07:00
parent 774c35c2a1
commit 20b83a46d6
2 changed files with 30 additions and 3 deletions

View File

@ -840,6 +840,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";

View File

@ -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 ];
};