diff --git a/lib/licenses.nix b/lib/licenses.nix index aea7841c071..372adea4f9a 100644 --- a/lib/licenses.nix +++ b/lib/licenses.nix @@ -25,6 +25,7 @@ rec { shortName = "asl"; fullName = "Amazon Software License"; url = http://aws.amazon.com/asl/; + free = false; }; amd = { @@ -290,11 +291,21 @@ rec { url = http://www.tcl.tk/software/tcltk/license.html; }; - unfree = "unfree"; + unfree = { + fullName = "Unfree"; + free = false; + }; - unfreeRedistributable = "unfree-redistributable"; + unfreeRedistributable = { + fullName = "Unfree redistributable"; + free = false; + }; - unfreeRedistributableFirmware = "unfree-redistributable-firmware"; + unfreeRedistributableFirmware = { + fullName = "Unfree redistributable firmware"; + # Note: we currently consider these "free" for inclusion in the + # channel and NixOS images. + }; unlicense = { shortName = "Unlicense"; diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 399843c2760..038afc585c2 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -41,6 +41,9 @@ let unsafeGetAttrPos = builtins.unsafeGetAttrPos or (n: as: null); + isUnfree = licenses: lib.lists.any (l: + !l.free or true || l == "unfree" || l == "unfree-redistributable") licenses; + # The stdenv that we are producing. result = @@ -84,7 +87,7 @@ let unsafeGetAttrPos "name" attrs; pos' = if pos != null then "‘" + pos.file + ":" + toString pos.line + "’" else "«unknown-file»"; in - if !allowUnfree && (let l = lib.lists.toList attrs.meta.license or []; in lib.lists.elem "unfree" l || lib.lists.elem "unfree-redistributable" l) && !(allowUnfreePredicate attrs) then + if !allowUnfree && isUnfree (lib.lists.toList attrs.meta.license or []) && !allowUnfreePredicate attrs then throw '' Package ‘${attrs.name}’ in ${pos'} has an unfree license, refusing to evaluate. ${forceEvalHelp "Unfree"}''