From 4f7f469c8257e136f24bbd2f079e8507790eca57 Mon Sep 17 00:00:00 2001 From: "Christoph Engelbert (noctarius)" Date: Mon, 6 Mar 2023 13:05:31 +0100 Subject: [PATCH] timescaledb: Fixed the licensing for the timescaledb package to be split into TSL (Timescale Community License) and Apache 2.0 components. TimescaleDB provides two types of licenses, Apache 2.0 and Timescale Community License (TSL), with different feature sets. While all the code is in the same repository, the build system can build both versions depending on the build parameters set in. Co-authored-by: Emily Lange --- lib/licenses.nix | 7 +++++++ pkgs/servers/sql/postgresql/ext/timescaledb.nix | 7 ++++--- pkgs/servers/sql/postgresql/packages.nix | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/licenses.nix b/lib/licenses.nix index 2bca8d36b560..873056d2fa5e 100644 --- a/lib/licenses.nix +++ b/lib/licenses.nix @@ -909,6 +909,13 @@ in mkLicense lset) ({ url = "https://github.com/thestk/stk/blob/master/LICENSE"; }; + tsl = { + shortName = "TSL"; + fullName = "Timescale License Agreegment"; + url = "https://github.com/timescale/timescaledb/blob/main/tsl/LICENSE-TIMESCALE"; + unfree = true; + }; + tcltk = { spdxId = "TCL"; fullName = "TCL/TK License"; diff --git a/pkgs/servers/sql/postgresql/ext/timescaledb.nix b/pkgs/servers/sql/postgresql/ext/timescaledb.nix index a476d3e21d3a..35c91efbe42b 100644 --- a/pkgs/servers/sql/postgresql/ext/timescaledb.nix +++ b/pkgs/servers/sql/postgresql/ext/timescaledb.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, cmake, postgresql, openssl, libkrb5 }: +{ lib, stdenv, fetchFromGitHub, cmake, postgresql, openssl, libkrb5, enableUnfree ? true }: # # To enable on NixOS: # config.services.postgresql = let @@ -12,7 +12,7 @@ # } stdenv.mkDerivation rec { - pname = "timescaledb"; + pname = "timescaledb${lib.optionalString (!enableUnfree) "-apache"}"; version = "2.10.1"; nativeBuildInputs = [ cmake ]; @@ -26,6 +26,7 @@ stdenv.mkDerivation rec { }; cmakeFlags = [ "-DSEND_TELEMETRY_DEFAULT=OFF" "-DREGRESS_CHECKS=OFF" "-DTAP_CHECKS=OFF" ] + ++ lib.optionals (!enableUnfree) [ "-DAPACHE_ONLY=ON" ] ++ lib.optionals stdenv.isDarwin [ "-DLINTER=OFF" ]; # Fix the install phase which tries to install into the pgsql extension dir, @@ -48,7 +49,7 @@ stdenv.mkDerivation rec { changelog = "https://github.com/timescale/timescaledb/raw/${version}/CHANGELOG.md"; maintainers = with maintainers; [ marsam ]; platforms = postgresql.meta.platforms; - license = licenses.asl20; + license = with licenses; if enableUnfree then tsl else asl20; broken = versionOlder postgresql.version "12"; }; } diff --git a/pkgs/servers/sql/postgresql/packages.nix b/pkgs/servers/sql/postgresql/packages.nix index b6fc6480aecb..211a54bb5523 100644 --- a/pkgs/servers/sql/postgresql/packages.nix +++ b/pkgs/servers/sql/postgresql/packages.nix @@ -55,6 +55,7 @@ self: super: { temporal_tables = super.callPackage ./ext/temporal_tables.nix { }; timescaledb = super.callPackage ./ext/timescaledb.nix { }; + timescaledb-apache = super.callPackage ./ext/timescaledb.nix { enableUnfree = false; }; timescaledb_toolkit = super.callPackage ./ext/timescaledb_toolkit.nix { };