From 3426dd04bbf7aacd2b51b8a40e62e29f4381e7a8 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sun, 23 Nov 2025 23:58:23 +0000 Subject: [PATCH] wrappers: use flake-locked `lib` instead of host's MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, we constructed Nixvim's extended lib from the host configuration's lib. Naïvely, this potentially allowed fetching fewer Nixpkgs revisions and instantiating fewer lib instances. However, it also means our `lib` interface is unstable, especially when the host configuration is using a different Nixpkgs release to Nixvim. --- wrappers/_shared.nix | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/wrappers/_shared.nix b/wrappers/_shared.nix index 77874b52..78d41498 100644 --- a/wrappers/_shared.nix +++ b/wrappers/_shared.nix @@ -70,10 +70,16 @@ in config = mkMerge [ { - # Make our lib available to the host modules - # - the `config.lib.nixvim` option is the nixvim-lib - # - the `nixvimLib` arg is `lib` extended with our overlay - lib.nixvim = lib.mkDefault config._module.args.nixvimLib.nixvim; + # Make Nixvim's extended lib available to the host modules + # - The `config.lib.nixvim` option is Nixvim's section of the lib + # (based on our flake's locked Nixpkgs lib) + # - The `nixvimLib` arg is `lib` extended with our overlay + # (based on the host configuration's `lib`) + # + # 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 self.lib.nixvim; _module.args.nixvimLib = lib.mkDefault (lib.extend self.lib.overlay); }