From 666476ff53ad751aaab9ea65ce601c5992b22d2f Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Tue, 17 Mar 2026 16:14:31 +0100 Subject: [PATCH] lib.meta.getLicenseBySpdxId: set spdxId in default value Nixpkgs does not contain an entry in lib.licenses for every SPDX license, so it is expected that a valid SPDX id would yield no proper result from getLicenseFromSpdxId. Hence, we should set spdxId in the default value. Users that think their SPDX ID may be invalid should rather use getLicenseFromSpdxIdOr. --- lib/meta.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/meta.nix b/lib/meta.nix index 5c4627e3cec7..1a1676f56aff 100644 --- a/lib/meta.nix +++ b/lib/meta.nix @@ -434,8 +434,9 @@ rec { getLicenseFromSpdxId = licstr: getLicenseFromSpdxIdOr licstr ( - lib.warn "getLicenseFromSpdxId: No license matches the given SPDX ID: ${licstr}" { + lib.warn "getLicenseFromSpdxId: No license with the given SPDX ID found: ${licstr}" { shortName = licstr; + spdxId = licstr; } );