Skip to content

Instantly share code, notes, and snippets.

@betaboon
Last active November 5, 2018 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betaboon/1c09d90f911f59f5ebea7df8960dff97 to your computer and use it in GitHub Desktop.
Save betaboon/1c09d90f911f59f5ebea7df8960dff97 to your computer and use it in GitHub Desktop.
{ config, ... }: with lib; let
mySubmoduleOptions = { name, config, ... }: {
options = {
myOption = mkOption {
default = true;
type = types.bool;
};
};
};
in {
options = {
mymodule.defaults = mkOption {
default = {};
type = types.submodule mySubmoduleOptions;
};
mymodule.services = mkOption {
default = {};
type = with types; attrsOf (submodule {
options = {
custom = mkOption {
default = {};
type = types.submodule (recursiveUpdate
(mySubmoduleOptions {})
(with config.mymodule.defaults; {
options.myOption.default = myOption;
}));
};
};
});
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment