Allow marking licenses as unfree
This allows licenses like the Amazon Software License to be identified properly while still preventing packages with those licenses from being distributed in the Nixpkgs/NixOS channels.
This commit is contained in:
parent
858cfbc993
commit
af0557cf82
@ -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";
|
||||
|
@ -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"}''
|
||||
|
Loading…
Reference in New Issue
Block a user