What are the arguments available to a given module?

Note: I use the terms “arguments” and “attributes” more or less interchangeably.

The NixOS wiki entry for modules mentions that a module can be a written as a function that accepts an attribute set, and it says it may require the attribute set to contain config, options, pkgs, and modulesPath arguments. However, that is clearly not all attributes available, as the immediately following example uses the lib attribute.

Is there an exhaustive list anywhere that details all the attributes available to modules (ideally with descriptions of each one)?

4 Likes

No exhaustive docs I am aware of.

I dig a bit into the source code here. It is basically those you mention, plus whatever gets passed in through _module.args option and specialArgs and other eval-config.nix arguments like that.

4 Likes