mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-20 16:15:43 +02:00
lib/modules: allow specifying system
as an evalNixvim
arg
This commit is contained in:
parent
7790746d38
commit
8c6f9ed8c4
3 changed files with 12 additions and 9 deletions
|
@ -21,12 +21,16 @@ in
|
|||
{
|
||||
modules ? [ ],
|
||||
extraSpecialArgs ? { },
|
||||
system ? null, # Can also be defined using the `nixpkgs.hostPlatform` option
|
||||
}:
|
||||
# Ensure a suitable `lib` is used
|
||||
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`.
|
||||
See https://nix-community.github.io/nixvim/user-guide/helpers.html#using-a-custom-lib-with-nixvim'';
|
||||
assert lib.assertMsg (system != null -> lib.isString system) ''
|
||||
When `system` is supplied to `evalNixvim`, it must be a string.
|
||||
To define a more complex system, please use nixvim's `nixpkgs.hostPlatform` option.'';
|
||||
lib.evalModules {
|
||||
modules = modules ++ [
|
||||
../modules/top-level
|
||||
|
@ -34,6 +38,10 @@ in
|
|||
_file = "<nixvim-flake>";
|
||||
flake = lib.mkOptionDefault flake;
|
||||
}
|
||||
(lib.optionalAttrs (system != null) {
|
||||
_file = "evalNixvim";
|
||||
nixpkgs.hostPlatform = lib.mkOptionDefault { inherit system; };
|
||||
})
|
||||
];
|
||||
specialArgs = {
|
||||
modulesPath = ../modules;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue