1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-29 05:31:05 +01:00

wrappers: use importApply to preserve module location

The `import module args` pattern is useful for applying inputs from
outside of the module system, however it discards module location
metadata that is usually associated with file-path modules.

`lib.modules.importApply` solves that problem by wrapping the applied
module using `lib.modules.setDefaultModuleLocation`.

This means documentation, warnings, and errors will show the correct
location.
This commit is contained in:
Matt Sturgeon 2025-11-24 10:41:21 +00:00
parent 453fe40893
commit 947cb0aaed
2 changed files with 10 additions and 4 deletions

View file

@ -3,6 +3,9 @@
lib,
...
}:
let
inherit (lib.modules) importApply;
in
{
perSystem =
{ system, ... }:
@ -17,7 +20,7 @@
flake = {
nixosModules = {
nixvim = import ../wrappers/nixos.nix self;
nixvim = importApply ../wrappers/nixos.nix self;
default = self.nixosModules.nixvim;
};
# Alias for backward compatibility
@ -29,11 +32,11 @@
in
lib.warnIf cond msg self.homeModules;
homeModules = {
nixvim = import ../wrappers/hm.nix self;
nixvim = importApply ../wrappers/hm.nix self;
default = self.homeModules.nixvim;
};
nixDarwinModules = {
nixvim = import ../wrappers/darwin.nix self;
nixvim = importApply ../wrappers/darwin.nix self;
default = self.nixDarwinModules.nixvim;
};
};