flâneur

1. A basic module — nix.dev documentation

nix.dev · saved by 1 readers

When evaluated by the module system, it produces an attribute set based on the declarations and definitions. The simplest possible module is a function that takes any attributes and returns an empty attribute set: To define any values, the module system first has to know which ones are allowed. This is done by declaring options that specify which attributes can be set and used elsewhere. Options are declared under the top-level options attribute with lib.mkOption. Note The lib argument is passed automatically by the module system. This makes Nixpkgs library functions available in each module’s function body. The ellipsis ... is necessary because the module system can pass arbitrary arguments to modules. The attribute type in the argument to lib.mkOption specifies which values are valid for an option. There are several types available under lib.types. Here we have declared an option name of type str: The module system will expect a string when a value is defined. Now that we have declar

saved by