Files
nixvim/modules/wrappers.nix
Matt Sturgeon 909aa0a782 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.
2026-05-24 23:09:56 +00:00

37 lines
923 B
Nix

{
lib,
extendModules,
...
}:
let
importWrapper = lib.flip lib.modules.importApply {
inherit extendModules;
nixvimLib = lib.nixvim;
};
in
{
options.build = {
nixosModule = lib.mkOption {
type = lib.types.deferredModule;
description = "A NixOS module that installs this Nixvim configuration.";
readOnly = true;
};
homeModule = lib.mkOption {
type = lib.types.deferredModule;
description = "A Home Manager module that installs this Nixvim configuration.";
readOnly = true;
};
nixDarwinModule = lib.mkOption {
type = lib.types.deferredModule;
description = "A nix-darwin module that installs this Nixvim configuration.";
readOnly = true;
};
};
config.build = lib.mapAttrs (_: importWrapper) {
nixosModule = ../wrappers/nixos.nix;
homeModule = ../wrappers/hm.nix;
nixDarwinModule = ../wrappers/darwin.nix;
};
}