diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-11-05 15:15:00 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-11-05 15:15:00 +0100 |
commit | af0557cf82080ab51bf82e1352f861d8ee6e469d (patch) | |
tree | eec83035c2c4c61ca778eeca0bfab5af0d4ebf35 /pkgs | |
parent | 858cfbc993b393f84afed4e8e4feaf86a509e9d9 (diff) | |
download | nixlib-af0557cf82080ab51bf82e1352f861d8ee6e469d.tar nixlib-af0557cf82080ab51bf82e1352f861d8ee6e469d.tar.gz nixlib-af0557cf82080ab51bf82e1352f861d8ee6e469d.tar.bz2 nixlib-af0557cf82080ab51bf82e1352f861d8ee6e469d.tar.lz nixlib-af0557cf82080ab51bf82e1352f861d8ee6e469d.tar.xz nixlib-af0557cf82080ab51bf82e1352f861d8ee6e469d.tar.zst nixlib-af0557cf82080ab51bf82e1352f861d8ee6e469d.zip |
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.
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/stdenv/generic/default.nix | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 399843c27603..038afc585c28 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"}'' |