Add docs and autoloads for the lib option

This commit is contained in:
Archit Gupta 2023-09-14 01:36:43 -07:00
parent d75f8fea8b
commit 1bc31924ee
2 changed files with 22 additions and 0 deletions

View File

@ -684,6 +684,25 @@ These can be paths, which is preferred as it results in better debug output:
}
```
### lib
The `lib` option allows you to configure the flake's `lib` output.
For example:
```nix
{
inputs.flakelight.url = "github:accelbread/flakelight";
outputs = { flakelight, ... }:
flakelight ./. {
lib = {
addFive = x: x + 5;
addFour = x: x + 4;
};
};
}
```
### functor
The `functor` option allows you to make your flake callable.
@ -759,6 +778,7 @@ The following options can be autoloaded with optional module args:
- homeModules
- homeConfigurations
- flakelightModules
- lib
The following options can be autoloaded (no module args):

View File

@ -43,6 +43,7 @@ in
homeConfigurations = autoImportArgs' [ "homeConfigurations" "home" ];
flakelightModule = autoImport' "flakelightModule";
flakelightModules = autoImportArgs' "flakelightModules";
lib = autoImportArgs' "lib";
functor = autoImport' "functor";
in
mkMerge [
@ -79,6 +80,7 @@ in
(mkIf (homeConfigurations != null) { inherit homeConfigurations; })
(mkIf (flakelightModule != null) { inherit flakelightModule; })
(mkIf (flakelightModules != null) { inherit flakelightModules; })
(mkIf (lib != null) { inherit lib; })
(mkIf (functor != null) { inherit functor; })
];
}