git.iko.soy/typeable/nixpkgs
on master help sign in
modules: Add mkSinkUndeclaredOptions.
commit2f365923d674cab9a935c62652c7dc4ee003d243 authorNicolas B. Pierron <nicolas.b.pierron@gmail.com> dateSun 21 Dec 2014, 14:50 (12 years ago) parentf94580d
1 file changed+17
lib/options.nix+17
lib/options.nix+17
@@ -31,6 +31,23 @@ rec {
3131 type = lib.types.bool;
3232 };
3333
34+ # This option accept anything, but it does not produce any result. This
35+ # is useful for sharing a module across different module sets without
36+ # having to implement similar features as long as the value of the options
37+ # are not expected.
38+ mkSinkUndeclaredOptions = attrs: mkOption ({
39+ internal = true;
40+ visible = false;
41+ default = false;
42+ description = "Sink for option definitions.";
43+ type = mkOptionType {
44+ name = "sink";
45+ check = x: true;
46+ merge = loc: defs: false;
47+ };
48+ apply = x: throw "Option value is not readable because the option is not declared.";
49+ } // attrs);
50+
3451 mergeDefaultOption = loc: defs:
3552 let list = getValues defs; in
3653 if length list == 1 then head list