mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35: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
|
@ -2,9 +2,8 @@
|
||||||
{
|
{
|
||||||
perSystem =
|
perSystem =
|
||||||
{
|
{
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
makeNixvimWithModule,
|
makeNixvimWithModule,
|
||||||
|
system,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
@ -13,12 +12,7 @@
|
||||||
makeNixvim = module: makeNixvimWithModule { inherit module; };
|
makeNixvim = module: makeNixvimWithModule { inherit module; };
|
||||||
|
|
||||||
nixvimConfiguration = helpers.modules.evalNixvim {
|
nixvimConfiguration = helpers.modules.evalNixvim {
|
||||||
modules = [
|
inherit system;
|
||||||
{
|
|
||||||
_file = ./legacy-packages.nix;
|
|
||||||
nixpkgs.pkgs = lib.mkDefault pkgs;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,12 +21,16 @@ in
|
||||||
{
|
{
|
||||||
modules ? [ ],
|
modules ? [ ],
|
||||||
extraSpecialArgs ? { },
|
extraSpecialArgs ? { },
|
||||||
|
system ? null, # Can also be defined using the `nixpkgs.hostPlatform` option
|
||||||
}:
|
}:
|
||||||
# Ensure a suitable `lib` is used
|
# Ensure a suitable `lib` is used
|
||||||
assert lib.assertMsg (extraSpecialArgs ? lib -> extraSpecialArgs.lib ? nixvim) ''
|
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.
|
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`.
|
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'';
|
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 {
|
lib.evalModules {
|
||||||
modules = modules ++ [
|
modules = modules ++ [
|
||||||
../modules/top-level
|
../modules/top-level
|
||||||
|
@ -34,6 +38,10 @@ in
|
||||||
_file = "<nixvim-flake>";
|
_file = "<nixvim-flake>";
|
||||||
flake = lib.mkOptionDefault flake;
|
flake = lib.mkOptionDefault flake;
|
||||||
}
|
}
|
||||||
|
(lib.optionalAttrs (system != null) {
|
||||||
|
_file = "evalNixvim";
|
||||||
|
nixpkgs.hostPlatform = lib.mkOptionDefault { inherit system; };
|
||||||
|
})
|
||||||
];
|
];
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
modulesPath = ../modules;
|
modulesPath = ../modules;
|
||||||
|
|
|
@ -164,7 +164,8 @@ in
|
||||||
apply = lib.systems.elaborate;
|
apply = lib.systems.elaborate;
|
||||||
defaultText = lib.literalMD ''
|
defaultText = lib.literalMD ''
|
||||||
- Inherited from the "host" configuration's `pkgs`
|
- Inherited from the "host" configuration's `pkgs`
|
||||||
- Must be specified manually when building a standalone nixvim
|
- Or `evalNixvim`'s `system` argument
|
||||||
|
- Otherwise, must be specified manually
|
||||||
'';
|
'';
|
||||||
description = ''
|
description = ''
|
||||||
Specifies the platform where the Nixvim configuration will run.
|
Specifies the platform where the Nixvim configuration will run.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue