wrappers: pass in existing lib.nixvim

Extracting `specialArgs.lib.nixvim` from the final `programs.nixvim`
configuration is neat, but recursive. In non-lazy scenarios, it can end
up infinitely recursive.

We could extract `specialArgs.lib.nixvim` from another nixvim
configuration, such as one of the earlier `extendModules` evaluations,
however it is better to avoid evaluating multiple configurations
unnecessarily.

Instead, revert back to getting `lib.nixvim` from the same configuration
we get `extendModules` from.
This commit is contained in:
Matt Sturgeon
2026-05-24 23:09:56 +00:00
parent e71dab10a6
commit 909aa0a782
5 changed files with 13 additions and 2 deletions
+4 -1
View File
@@ -4,7 +4,10 @@
...
}:
let
importWrapper = lib.flip lib.modules.importApply { inherit extendModules; };
importWrapper = lib.flip lib.modules.importApply {
inherit extendModules;
nixvimLib = lib.nixvim;
};
in
{
options.build = {
+3 -1
View File
@@ -1,4 +1,6 @@
{
# A `lib.nixvim` instance
nixvimLib,
# Function used to evaluate the `programs.nixvim` configuration
extendModules,
# Option path where extraFiles should go
@@ -86,7 +88,7 @@ in
# NOTE: It is important that we use the flake-locked Nixpkgs lib,
# so that we can safely use recently added lib features.
# TODO: Consider deprecating `_module.args.nixvimLib`?
lib.nixvim = lib.mkDefault finalConfiguration._module.specialArgs.lib.nixvim;
lib.nixvim = lib.mkDefault nixvimLib;
_module.args.nixvimLib = lib.mkDefault (lib.extend libOverlay);
}
+2
View File
@@ -1,4 +1,5 @@
{
nixvimLib,
extendModules,
}:
{
@@ -20,6 +21,7 @@ in
imports = [
(importApply ./_shared.nix {
inherit nixvimLib;
inherit
(extendModules {
specialArgs.darwinConfig = config;
+2
View File
@@ -1,4 +1,5 @@
{
nixvimLib,
extendModules,
}:
{
@@ -17,6 +18,7 @@ in
imports = [
(import ./_shared.nix {
inherit nixvimLib;
inherit
(extendModules {
specialArgs.hmConfig = config;
+2
View File
@@ -1,4 +1,5 @@
{
nixvimLib,
extendModules,
}:
{
@@ -17,6 +18,7 @@ in
imports = [
(import ./_shared.nix {
inherit nixvimLib;
inherit
(extendModules {
specialArgs.nixosConfig = config;