dischargeProperties
lib.modules.dischargeProperties
Docs pulled from | This Revision | 11 minutes ago
Given a config value, expand mkMerge properties, and discharge any mkIf conditions. That is, this is the place where mkIf conditions are actually evaluated. The result is a list of config values. For example, ‘mkIf false x’ yields ‘[]’, ‘mkIf true x’ yields ‘[x]’, and
mkMerge [ 1 (mkIf true 2) (mkIf true (mkIf false 3)) ]
yields ‘[ 1 2 ]’.
Inputs
def
-
1. Function argument
Noogle detected
Implementation
The following is the current implementation of this function.
dischargeProperties = def:
if def._type or "" == "merge" then
concatMap dischargeProperties def.contents
else if def._type or "" == "if" then
if isBool def.condition then
if def.condition then
dischargeProperties def.content
else
[ ]
else
throw "‘mkIf’ called with a non-Boolean condition"
else
[ def ];