NixOS has modules to have non-intrusive extensions. Modules are made to avoid manipulating the core of NixOS while allowing the user to separate their This page describes how you can create a module. If you want a pratical view, you should have a look into this small tutorial.
edit Vocabulary
To find all files which are defining or declaring an option, you may refer to the generated NixOS manual or to the edit SyntaxModules are declared with the following syntax:
{
imports = [
# list of path to other modules.
];
options = {
# attribute set of option declarations.
};
config = {
# attribute set of option definitions.
};
}
Another syntax exists for cases where no option declaration are necessary:
{
require = [
# list of path to other modules.
];
# attribute set of option definitions.
}
Both of the previous syntax can be refined with an attribute set argument added on top:
{config, pkgs, ...}:
{
# ...
}
The following arguments can be retrieved from this attribute set:
For more information, you should refer to NixOS sources, with more insight into More computation or organisation can be necessary to enhance modules. In which case, you can add a
{config, pkgs, ...}:
let
# intermediate result.
in
{
# ...
}
edit References
edit Related Work
target configuration upgrades by abstracting the option of the configuration. Each file is a tree structure where leaves are values defined with an interpreted type. The interpreters are defined for each meta-configuration files name *.conf. Configuration files does not seems to interact with each other to make consistent configuration. They provide an UI for editing their configuration file. |