diff --git a/api_guide.md b/api_guide.md index e7834e7..dc6f650 100644 --- a/api_guide.md +++ b/api_guide.md @@ -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): diff --git a/builtinModules/nixDir.nix b/builtinModules/nixDir.nix index 9de71b9..3be433b 100644 --- a/builtinModules/nixDir.nix +++ b/builtinModules/nixDir.nix @@ -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; }) ]; }