diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2019-08-31 10:04:20 +0200 |
---|---|---|
committer | Frederik Rietdijk <fridh@fridh.nl> | 2019-08-31 10:04:20 +0200 |
commit | ad1d58c6227abf2a9c80311eb09166a532384ed2 (patch) | |
tree | 852498ff298f9b01c0d2c8b4c883da1a00912260 /lib | |
parent | ebe4fd146b29c92fb59f243f75e46afc9f1a9048 (diff) | |
parent | fc74ba8291a8a93cba428de6bc2e7c8c7f9330f4 (diff) |
Merge staging-next into staging
Diffstat (limited to 'lib')
-rw-r--r-- | lib/modules.nix | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/modules.nix b/lib/modules.nix index 0869eae1982b6..c3c903c1dfa80 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -323,16 +323,14 @@ rec { else mergeDefinitions loc opt.type defs'; - # Check whether the option is defined, and apply the ‘apply’ - # function to the merged value. This allows options to yield a - # value computed from the definitions. - value = - if !res.isDefined then - throw "The option `${showOption loc}' is used but not defined." - else if opt ? apply then - opt.apply res.mergedValue - else - res.mergedValue; + + # The value with a check that it is defined + valueDefined = if res.isDefined then res.mergedValue else + throw "The option `${showOption loc}' is used but not defined."; + + # Apply the 'apply' function to the merged value. This allows options to + # yield a value computed from the definitions + value = if opt ? apply then opt.apply valueDefined else valueDefined; in opt // { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value; |