mirror of
https://github.com/nix-community/nixvim.git
synced 2026-08-28 10:15:49 -05:00
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.
37 lines
923 B
Nix
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;
|
|
};
|
|
}
|