about summary refs log tree commit diff
path: root/lib/licenses.nix
diff options
context:
space:
mode:
Diffstat (limited to 'lib/licenses.nix')
-rw-r--r--lib/licenses.nix63
1 files changed, 39 insertions, 24 deletions
diff --git a/lib/licenses.nix b/lib/licenses.nix
index a608d3ec3f543..67744b499d8a3 100644
--- a/lib/licenses.nix
+++ b/lib/licenses.nix
@@ -1,25 +1,29 @@
 { lib }:
-
-lib.mapAttrs (lname: lset: let
-  defaultLicense = {
-    shortName = lname;
-    free = true; # Most of our licenses are Free, explicitly declare unfree additions as such!
-    deprecated = false;
-  };
-
-  mkLicense = licenseDeclaration: let
-    applyDefaults = license: defaultLicense // license;
-    applySpdx = license:
-      if license ? spdxId
-      then license // { url = "https://spdx.org/licenses/${license.spdxId}.html"; }
-      else license;
-    applyRedistributable = license: { redistributable = license.free; } // license;
-  in lib.pipe licenseDeclaration [
-    applyDefaults
-    applySpdx
-    applyRedistributable
-  ];
-in mkLicense lset) ({
+let
+  inherit (lib) optionalAttrs;
+
+  mkLicense = lname: {
+    shortName ? lname,
+    # Most of our licenses are Free, explicitly declare unfree additions as such!
+    free ? true,
+    deprecated ? false,
+    spdxId ? null,
+    url ? null,
+    fullName ? null,
+    redistributable ? free
+  }@attrs: {
+    inherit shortName free deprecated redistributable;
+  } // optionalAttrs (attrs ? spdxId) {
+    inherit spdxId;
+    url = "https://spdx.org/licenses/${spdxId}.html";
+  } // optionalAttrs (attrs ? url) {
+    inherit url;
+  } // optionalAttrs (attrs ? fullName) {
+    inherit fullName;
+  };
+
+in
+lib.mapAttrs mkLicense ({
   /* License identifiers from spdx.org where possible.
    * If you cannot find your license here, then look for a similar license or
    * add it to this list. The URL mentioned above is a good source for inspiration.
@@ -317,6 +321,12 @@ in mkLicense lset) ({
     free = false;
   };
 
+  cc-by-nd-40 = {
+    spdxId = "CC-BY-ND-4.0";
+    fullName = "Creative Commons Attribution-No Derivative Works v4.0";
+    free = false;
+  };
+
   cc-by-sa-10 = {
     spdxId = "CC-BY-SA-1.0";
     fullName = "Creative Commons Attribution Share Alike 1.0";
@@ -917,7 +927,7 @@ in mkLicense lset) ({
 
   ncbiPd = {
     spdxId = "NCBI-PD";
-    fullname = "NCBI Public Domain Notice";
+    fullName = "NCBI Public Domain Notice";
     # Due to United States copyright law, anything with this "license" does not have a copyright in the
     # jurisdiction of the United States. However, other jurisdictions may assign the United States
     # government copyright to the work, and the license explicitly states that in such a case, no license
@@ -1089,6 +1099,11 @@ in mkLicense lset) ({
     url = "https://qwt.sourceforge.io/qwtlicense.html";
   };
 
+  radiance = {
+    fullName = "The Radiance Software License, Version 2.0";
+    url = "https://github.com/LBNL-ETA/Radiance/blob/master/License.txt";
+  };
+
   ruby = {
     spdxId = "Ruby";
     fullName = "Ruby License";
@@ -1161,7 +1176,7 @@ in mkLicense lset) ({
     shortName = "TSL";
     fullName = "Timescale License Agreegment";
     url = "https://github.com/timescale/timescaledb/blob/main/tsl/LICENSE-TIMESCALE";
-    unfree = true;
+    free = false;
   };
 
   tcltk = {
@@ -1297,7 +1312,7 @@ in mkLicense lset) ({
 
   zsh = {
     url = "https://github.com/zsh-users/zsh/blob/master/LICENCE";
-    fulllName = "Zsh License";
+    fullName = "Zsh License";
   };
 
   zpl20 = {