mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-25 11:49:40 +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:
parent
453fe40893
commit
947cb0aaed
2 changed files with 10 additions and 4 deletions
|
|
@ -3,6 +3,9 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib.modules) importApply;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
perSystem =
|
perSystem =
|
||||||
{ system, ... }:
|
{ system, ... }:
|
||||||
|
|
@ -17,7 +20,7 @@
|
||||||
|
|
||||||
flake = {
|
flake = {
|
||||||
nixosModules = {
|
nixosModules = {
|
||||||
nixvim = import ../wrappers/nixos.nix self;
|
nixvim = importApply ../wrappers/nixos.nix self;
|
||||||
default = self.nixosModules.nixvim;
|
default = self.nixosModules.nixvim;
|
||||||
};
|
};
|
||||||
# Alias for backward compatibility
|
# Alias for backward compatibility
|
||||||
|
|
@ -29,11 +32,11 @@
|
||||||
in
|
in
|
||||||
lib.warnIf cond msg self.homeModules;
|
lib.warnIf cond msg self.homeModules;
|
||||||
homeModules = {
|
homeModules = {
|
||||||
nixvim = import ../wrappers/hm.nix self;
|
nixvim = importApply ../wrappers/hm.nix self;
|
||||||
default = self.homeModules.nixvim;
|
default = self.homeModules.nixvim;
|
||||||
};
|
};
|
||||||
nixDarwinModules = {
|
nixDarwinModules = {
|
||||||
nixvim = import ../wrappers/darwin.nix self;
|
nixvim = importApply ../wrappers/darwin.nix self;
|
||||||
default = self.nixDarwinModules.nixvim;
|
default = self.nixDarwinModules.nixvim;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkIf
|
mkIf
|
||||||
;
|
;
|
||||||
|
inherit (lib.modules)
|
||||||
|
importApply
|
||||||
|
;
|
||||||
cfg = config.programs.nixvim;
|
cfg = config.programs.nixvim;
|
||||||
evalArgs = {
|
evalArgs = {
|
||||||
extraSpecialArgs = {
|
extraSpecialArgs = {
|
||||||
|
|
@ -21,7 +24,7 @@ in
|
||||||
{
|
{
|
||||||
_file = ./darwin.nix;
|
_file = ./darwin.nix;
|
||||||
|
|
||||||
imports = [ (import ./_shared.nix { inherit self evalArgs; }) ];
|
imports = [ (importApply ./_shared.nix { inherit self evalArgs; }) ];
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue