query
On this page

isRedistributable

lib.licenses.isRedistributable

Docs pulled from | This Revision | 31 minutes ago


Nixpkgs manual

Check whether a license expression is redistributable.

Example

isRedistributable (with lib.licenses; (AND [ ncsa (WITH asl20 llvm-exception) ]))
=> true

Type

isRedistributable :: AttrSet -> Bool

Arguments

  • [license] License expression to check if redistributable

Noogle detected

Implementation

The following is the current implementation of this function.

license:
    let
      OR = if permissive then lib.any else lib.all;
      AND = if permissive then lib.all else lib.any;
    in
    if license.licenseType == "simple" then
      predicate license
    else if license.licenseType == "compound" then
      if license.operator == "OR" then
        OR (x: evaluateProperty predicate permissive x) license.licenses
      else if license.operator == "AND" then
        AND (x: evaluateProperty predicate permissive x) license.licenses
      else
        throw "Unknown license operator"
    else if license.licenseType == "exception" then
      AND (x: evaluateProperty predicate permissive x) [
        license.license
        license.exception
      ]
    else if license.licenseType == "plus" then
      evaluateProperty predicate permissive license.license
    else
      throw "Unknown license type or legacy license"