diff --git a/modules/flake/configurations/default-generators.nix b/modules/flake/configurations/default-generators.nix index e14a91f..fe3bee3 100644 --- a/modules/flake/configurations/default-generators.nix +++ b/modules/flake/configurations/default-generators.nix @@ -5,9 +5,9 @@ let and hasFiles hasDirectories - configuration-type-to-outputs-modules; -in -let + configuration-type-to-outputs-modules + ; + # `pkgs` with flake's overlays # NOTE: done here to avoid infinite recursion pkgs' = system: diff --git a/modules/flake/configurations/default.nix b/modules/flake/configurations/default.nix index 9935997..d0fd6dd 100644 --- a/modules/flake/configurations/default.nix +++ b/modules/flake/configurations/default.nix @@ -1,21 +1,19 @@ { lib, config, self, inputs, withSystem, ... }: -let - inherit (config.lib) - and - hasFiles - hasDirectories - recurseDir - kebabToCamel - configuration-type-to-outputs-modules; -in { imports = [ + ../lib ./default-generators.nix ]; options = let - inherit (lib) types; + inherit (lib) + types + ; + inherit (config.lib) + recurseDir + kebabToCamel + ; in { auto.configurations = lib.mkOption { description = '' diff --git a/modules/flake/lib/default.nix b/modules/flake/lib/default.nix index 2debd5c..de5632a 100644 --- a/modules/flake/lib/default.nix +++ b/modules/flake/lib/default.nix @@ -6,9 +6,12 @@ ]; options = let - inherit (lib) types; + inherit (lib) + types + ; in { lib = lib.mkOption { + internal = true; type = types.unspecified; }; }; diff --git a/modules/flake/lib/things.nix b/modules/flake/lib/things.nix index 72bfd7f..b47bf23 100644 --- a/modules/flake/lib/things.nix +++ b/modules/flake/lib/things.nix @@ -1,14 +1,13 @@ { lib, config, self, inputs, ... }: -let - inherit (config.lib) - and - eq - hasFiles - ; -in { - config.lib = rec { + config.lib = let + inherit (config.lib) + and + eq + hasFiles + ; + in rec { # Try to passthru `inputs` by default defaultThingHandle = { raw, thingType }: name: result: let thing = diff --git a/modules/flake/modules/default.nix b/modules/flake/modules/default.nix index 5e13b8e..b962515 100644 --- a/modules/flake/modules/default.nix +++ b/modules/flake/modules/default.nix @@ -1,21 +1,24 @@ { lib, config, self, inputs, ... }: -let - inherit (config.lib) - createThings - kebabToCamel; -in -let - # Modules helpers - createModules = baseDir: - createThings { - inherit baseDir; - thingType = "module"; - }; -in { + imports = [ + ../lib + ]; + options = let - inherit (lib) types; + inherit (lib) + types + ; + inherit (config.lib) + createThings + kebabToCamel + ; + + createModules = baseDir: + createThings { + inherit baseDir; + thingType = "module"; + }; in { auto.modules = lib.mkOption { description = '' @@ -76,7 +79,6 @@ in (createModules dir); }; }; - config = {}; })); # TODO: put in a more visible place default = { diff --git a/modules/flake/overlays/default.nix b/modules/flake/overlays/default.nix index 3bfe975..9d5c565 100644 --- a/modules/flake/overlays/default.nix +++ b/modules/flake/overlays/default.nix @@ -1,19 +1,23 @@ { lib, config, self, inputs, ... }: -let - inherit (config.lib) - createThings; -in -let - createOverlays = baseDir: - createThings { - inherit baseDir; - thingType = "overlay"; - }; -in { + imports = [ + ../lib + ]; + options = let - inherit (lib) types; + inherit (lib) + types + ; + inherit (config.lib) + createThings + ; + + createOverlays = baseDir: + createThings { + inherit baseDir; + thingType = "overlay"; + }; in { auto.overlays = lib.mkOption { description = '' diff --git a/modules/flake/packages/default.nix b/modules/flake/packages/default.nix index c260a80..40d74ba 100644 --- a/modules/flake/packages/default.nix +++ b/modules/flake/packages/default.nix @@ -1,23 +1,27 @@ { lib, config, self, inputs, ... }: -let - inherit (config.lib) - createThings; -in -let - createPackages = baseDir: - createThings { - inherit baseDir; - thingType = "package"; - raw = false; - extras.systems = { - default = lib.const true; - }; - }; -in { + imports = [ + ../lib + ]; + options = let - inherit (lib) types; + inherit (lib) + types + ; + inherit (config.lib) + createThings + ; + + createPackages = baseDir: + createThings { + inherit baseDir; + thingType = "package"; + raw = false; + extras.systems = { + default = lib.const true; + }; + }; in { auto.packages = lib.mkOption { description = '' diff --git a/modules/flake/pkgs/default.nix b/modules/flake/pkgs/default.nix index 9a0807b..568f146 100644 --- a/modules/flake/pkgs/default.nix +++ b/modules/flake/pkgs/default.nix @@ -4,7 +4,7 @@ perSystem = { system, ... }: { _module.args.pkgs = import inputs.nixpkgs { inherit system; - # WARN: not including `self.packages` overylay + # WARN: not including `self.packages` overlay # because it causes an infinite recursion overlays = lib.attrValues self.overlays ++ [ inputs.neovim-nightly-overlay.overlays.default diff --git a/modules/flake/shells/default.nix b/modules/flake/shells/default.nix index 64ae99d..2b59a99 100644 --- a/modules/flake/shells/default.nix +++ b/modules/flake/shells/default.nix @@ -1,23 +1,27 @@ { lib, config, self, inputs, ... }: -let - inherit (config.lib) - createThings; -in -let - createDevShells = baseDir: - createThings { - inherit baseDir; - thingType = "devShell"; - raw = false; - extras.systems = { - default = lib.const true; - }; - }; -in { + imports = [ + ../lib + ]; + options = let - inherit (lib) types; + inherit (lib) + types + ; + inherit (config.lib) + createThings + ; + + createDevShells = baseDir: + createThings { + inherit baseDir; + thingType = "devShell"; + raw = false; + extras.systems = { + default = lib.const true; + }; + }; in { auto.devShells = lib.mkOption { description = ''