From 1bc31924eea5d37947af218c417b30d3b9c4ecff Mon Sep 17 00:00:00 2001 From: Archit Gupta Date: Thu, 14 Sep 2023 01:36:43 -0700 Subject: [PATCH] Add docs and autoloads for the lib option --- api_guide.md | 20 ++++++++++++++++++++ builtinModules/nixDir.nix | 2 ++ 2 files changed, 22 insertions(+) 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; }) ]; }