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";
|
shortName = "asl";
|
||||||
fullName = "Amazon Software License";
|
fullName = "Amazon Software License";
|
||||||
url = http://aws.amazon.com/asl/;
|
url = http://aws.amazon.com/asl/;
|
||||||
|
free = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
amd = {
|
amd = {
|
||||||
@ -290,11 +291,21 @@ rec {
|
|||||||
url = http://www.tcl.tk/software/tcltk/license.html;
|
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 = {
|
unlicense = {
|
||||||
shortName = "Unlicense";
|
shortName = "Unlicense";
|
||||||
|
@ -41,6 +41,9 @@ let
|
|||||||
|
|
||||||
unsafeGetAttrPos = builtins.unsafeGetAttrPos or (n: as: null);
|
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.
|
# The stdenv that we are producing.
|
||||||
result =
|
result =
|
||||||
|
|
||||||
@ -84,7 +87,7 @@ let
|
|||||||
unsafeGetAttrPos "name" attrs;
|
unsafeGetAttrPos "name" attrs;
|
||||||
pos' = if pos != null then "‘" + pos.file + ":" + toString pos.line + "’" else "«unknown-file»";
|
pos' = if pos != null then "‘" + pos.file + ":" + toString pos.line + "’" else "«unknown-file»";
|
||||||
in
|
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 ''
|
throw ''
|
||||||
Package ‘${attrs.name}’ in ${pos'} has an unfree license, refusing to evaluate.
|
Package ‘${attrs.name}’ in ${pos'} has an unfree license, refusing to evaluate.
|
||||||
${forceEvalHelp "Unfree"}''
|
${forceEvalHelp "Unfree"}''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user