summaryrefslogtreecommitdiffstats
path: root/lib/options.nix
diff options
context:
space:
mode:
authorNicolas B. Pierron <nicolas.b.pierron@gmail.com>2014-12-21 14:50:46 +0100
committerNicolas B. Pierron <nicolas.b.pierron@gmail.com>2014-12-21 14:50:46 +0100
commit2f365923d674cab9a935c62652c7dc4ee003d243 (patch)
treed2ab1fd79b8b5ce2cc4c22b3546c02c579c31ed5 /lib/options.nix
parentf94580da695808d04626775d6aa3864a91b735b2 (diff)
modules: Add mkSinkUndeclaredOptions.
Diffstat (limited to 'lib/options.nix')
-rw-r--r--lib/options.nix17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/options.nix b/lib/options.nix
index ecbd81cd997f..939f9948ceef 100644
--- a/lib/options.nix
+++ b/lib/options.nix
@@ -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