modules: adapt entrypoint to fixed-point lib and cleanup

This reduces the copies of nixpkgs's lib passed to the modules.
Need to reference `self.lib` for custom functions in modules, which imo is much
clearer.
For modules outside of nvf, use the nvf input's lib output.
This commit is contained in:
alfarel 2025-10-16 23:42:37 +00:00
commit 65c4e4aafd
No known key found for this signature in database

View file

@ -1,7 +1,7 @@
{ {
self, self,
inputs, inputs,
lib, ...
}: { }: {
pkgs, pkgs,
extraSpecialArgs ? {}, extraSpecialArgs ? {},
@ -10,17 +10,20 @@
extraModules ? [], extraModules ? [],
configuration ? {}, configuration ? {},
}: let }: let
inherit (pkgs) lib;
inherit (lib.modules) evalModules;
inherit (lib.strings) toString; inherit (lib.strings) toString;
inherit (lib.lists) concatLists; inherit (lib.trivial) warn;
inherit (lib.lists) concatLists optional optionals;
# import modules.nix with `check`, `pkgs` and `lib` as arguments # import modules.nix with `check` and `pkgs` as arguments
# check can be disabled while calling this file is called # check can be disabled while calling this file is called
# to avoid checking in all modules # to avoid checking in all modules
nvimModules = import ./modules.nix {inherit pkgs lib;}; nvimModules = import ./modules.nix {inherit pkgs;};
# evaluate the extended library with the modules # evaluate the extended library with the modules
# optionally with any additional modules passed by the user # optionally with any additional modules passed by the user
module = lib.evalModules { module = evalModules {
specialArgs = specialArgs =
extraSpecialArgs extraSpecialArgs
// { // {
@ -30,12 +33,12 @@
modules = concatLists [ modules = concatLists [
nvimModules nvimModules
modules modules
(lib.optional (configuration != {}) (lib.warn '' (optional (configuration != {}) (warn ''
nvf: passing 'configuration' to lib.neovimConfiguration is deprecated. nvf: passing 'configuration' to lib.neovimConfiguration is deprecated.
'' ''
configuration)) configuration))
(lib.optionals (extraModules != []) (lib.warn '' (optionals (extraModules != []) (warn ''
nvf: passing 'extraModules' to lib.neovimConfiguration is deprecated, use 'modules' instead. nvf: passing 'extraModules' to lib.neovimConfiguration is deprecated, use 'modules' instead.
'' ''
extraModules)) extraModules))