From 6b0c5d594ac88e7765c97deeda10c5b6e812f7a7 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Fri, 27 Sep 2024 01:02:57 +0100 Subject: [PATCH] lib/modules: assert that `specialArgs` has a valid `lib` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit End-users have ran into issues before when attempting to re-use a `lib` from elsewhere in nixvim's configuration. If a `lib` without the `nixvim` extension is used, this assertion will inform the user that this isn't supported. In the future we can also provide better ways for end-users to overlay their own lib with nixvim's extensions, but this is not yet implemented. Co-authored-by: GaƩtan Lepage <33058747+GaetanLepage@users.noreply.github.com> --- lib/modules.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/modules.nix b/lib/modules.nix index 897b6890..1da6f337 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -23,6 +23,11 @@ in # NOTE: this argument was always marked as experimental assert lib.assertMsg (!args ? "check") "`evalNixvim`: passing `check` is no longer supported. Checks are now done when evaluating `config.build.package` and can be avoided by using `config.build.packageUnchecked` instead."; + # Ensure a suitable `lib` is used + # TODO: offer a lib overlay that end-users could use to apply nixvim's extensions to their own `lib` + assert lib.assertMsg (extraSpecialArgs ? lib -> extraSpecialArgs.lib ? nixvim) '' + Nixvim requires a lib that includes some custom extensions, however the `lib` from `specialArgs` does not have a `nixvim` attr. + Remove `lib` from nixvim's `specialArgs` or ensure you apply nixvim's extensions to your `lib`.''; lib.evalModules { modules = [ ../modules/top-level ] ++ modules; specialArgs = {