query
On this page

evaluateNamedProperty

lib.licenses.evaluateNamedProperty

Docs pulled from | This Revision | 17 minutes ago


Nixpkgs manual

Evaluate a license expression for a given property name. The property must be defined as a boolean attribute of all licenses passed.

Inputs

name
Name of the Attribute which should be checked
permissive
Whether to apply checks permissive or reciprocal
license
License expression which should be evaluated

Type

evaluateNamedProperty :: String -> Bool -> AttrSet -> Bool

Example

lib.licenses.evaluateNamedProperty usage example

evaluateNamedProperty "deprecated" true (with lib.licenses; AND [ ncsa (WITH asl20 llvm-exception) ])
=> false

Noogle detected

Implementation

The following is the current implementation of this function.

evaluateNamedProperty =
    name: permissive:
    let
      OR = if permissive then any else all;
      AND = if permissive then all else any;
      evaluateComplexProperty = handleComplexProperty (evaluateNamedProperty name permissive) AND OR;
    in
    license:
    if license.licenseType == "simple" then license.${name} else evaluateComplexProperty license;