NixOS modules: Difference between revisions

imported>Makefu
add subsection "Advanced Use Cases" aka. things you shouldn't have to bother when you start with NixOS
imported>Qknight
No edit summary
Line 159: Line 159:
}
}
</syntaxhighlight>
</syntaxhighlight>
== More complex usages ==
The examples below contain:
* a child `mkOption` inherits their default from a parent `mkOption`
* reading default values from neighbouring `mkOption`(s) for conditional defaults
* passing in the config, to read the hostName from a submodule (email system)
* setting default values from attrset (email system)
Source:
* https://github.com/nixcloud/nixcloud-webservices/blob/master/modules/services/reverse-proxy/default.nix
* https://github.com/nixcloud/nixcloud-webservices/blob/master/modules/services/reverse-proxy/options.nix
* https://github.com/nixcloud/nixcloud-webservices/blob/master/modules/services/TLS/default.nix
* https://github.com/nixcloud/nixcloud-webservices/blob/master/modules/services/email/nixcloud-email.nix#L59
(sorry, dont' have more time to make this into a nice little guide yet, but this links should be pretty good introductions into more advanced module system usages) qknight


== References ==
== References ==