Document importDir

This commit is contained in:
Archit Gupta 2024-05-20 21:04:51 -07:00
parent 9dca671d0e
commit 6af2ed9b42

View File

@ -196,7 +196,8 @@ For a given option, the following is checked in order:
- Else if `${nixDir}/option` is a directory, it results in an attrset with an - Else if `${nixDir}/option` is a directory, it results in an attrset with an
attr for each importable item in the directory for which the values are the attr for each importable item in the directory for which the values are the
corresponding items imported. An importable item is a file ending with `.nix` corresponding items imported. An importable item is a file ending with `.nix`
or a directory containing a `default.nix`. or a directory containing a `default.nix`. This is the same as the flakelight
`importDir` function.
To enable using a directory for an attrset that includes a `default` attribute, To enable using a directory for an attrset that includes a `default` attribute,
attr names can be escaped with an underscore. For example, attr names can be escaped with an underscore. For example,
@ -204,11 +205,14 @@ attr names can be escaped with an underscore. For example,
Aliases for options can be set with the `nixDirAliases` option. For example, Aliases for options can be set with the `nixDirAliases` option. For example,
by default `nixDirAliases.nixosConfigurations = [ "nixos" ];` is set which means by default `nixDirAliases.nixosConfigurations = [ "nixos" ];` is set which means
"nixos" can be used instead of "nixosConfiguraions" for loading the files as "nixos" can be used instead of "nixosConfigurations" for loading the files as
described above. described above.
All options except for `nixDir` and `_module` can be configured this way. All options except for `nixDir` and `_module` can be configured this way.
To apply transformations on the output of an autoloaded directory, you can use
`option/default.nix` and load the directory with `flakelight.importDir`.
### outputs ### outputs
``` ```