Merge pull request #5421 from nbp/mkSink

modules: Add mkSinkUndeclaredOptions.
This commit is contained in:
Nicolas B. Pierron 2014-12-22 11:59:42 -08:00
commit c184d7e7e0

View File

@ -31,6 +31,23 @@ rec {
type = lib.types.bool;
};
# This option accept anything, but it does not produce any result. This
# is useful for sharing a module across different module sets without
# having to implement similar features as long as the value of the options
# are not expected.
mkSinkUndeclaredOptions = attrs: mkOption ({
internal = true;
visible = false;
default = false;
description = "Sink for option definitions.";
type = mkOptionType {
name = "sink";
check = x: true;
merge = loc: defs: false;
};
apply = x: throw "Option value is not readable because the option is not declared.";
} // attrs);
mergeDefaultOption = loc: defs:
let list = getValues defs; in
if length list == 1 then head list