2024-08-02 01:26:01 +01:00
|
|
|
{
|
|
|
|
lib,
|
2024-09-12 14:56:36 +01:00
|
|
|
self,
|
2024-12-23 11:55:32 +00:00
|
|
|
flake,
|
2024-08-02 01:26:01 +01:00
|
|
|
}:
|
2024-09-25 11:01:12 +01:00
|
|
|
let
|
|
|
|
removed = {
|
|
|
|
# Removed 2024-09-24
|
|
|
|
getAssertionMessages = "";
|
|
|
|
# Removed 2024-09-27
|
|
|
|
specialArgs = "It has been integrated into `evalNixvim`";
|
|
|
|
specialArgsWith = "It has been integrated into `evalNixvim`";
|
2024-12-18 22:12:51 +00:00
|
|
|
# Removed 2024-12-18
|
|
|
|
applyExtraConfig = "It has been moved to `lib.plugins.utils`";
|
|
|
|
mkConfigAt = "It has been moved to `lib.plugins.utils`";
|
2024-09-25 11:01:12 +01:00
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
2024-08-04 21:54:17 +01:00
|
|
|
# Evaluate nixvim modules, checking warnings and assertions
|
|
|
|
evalNixvim =
|
|
|
|
{
|
|
|
|
modules ? [ ],
|
|
|
|
extraSpecialArgs ? { },
|
2024-12-23 12:42:58 +00:00
|
|
|
system ? null, # Can also be defined using the `nixpkgs.hostPlatform` option
|
2024-12-23 11:54:35 +00:00
|
|
|
}:
|
2024-09-27 01:02:57 +01:00
|
|
|
# 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.
|
2025-01-17 00:13:26 +00:00
|
|
|
Remove `lib` from nixvim's `specialArgs` or ensure you apply nixvim's extensions to your `lib`.
|
2025-05-15 14:54:58 +01:00
|
|
|
See https://nix-community.github.io/nixvim/lib/index.html#using-a-custom-lib-with-nixvim'';
|
2024-12-23 12:42:58 +00:00
|
|
|
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.'';
|
2024-09-24 07:02:22 +01:00
|
|
|
lib.evalModules {
|
2024-12-15 06:51:20 +00:00
|
|
|
modules = modules ++ [
|
|
|
|
../modules/top-level
|
2024-12-23 11:55:32 +00:00
|
|
|
{
|
2024-12-15 06:51:20 +00:00
|
|
|
_file = "<nixvim-flake>";
|
2024-12-23 10:31:29 +00:00
|
|
|
flake = lib.mkOptionDefault flake;
|
2024-12-23 11:55:32 +00:00
|
|
|
}
|
2024-12-23 12:42:58 +00:00
|
|
|
(lib.optionalAttrs (system != null) {
|
|
|
|
_file = "evalNixvim";
|
|
|
|
nixpkgs.hostPlatform = lib.mkOptionDefault { inherit system; };
|
|
|
|
})
|
2024-12-15 06:51:20 +00:00
|
|
|
];
|
2024-09-25 11:01:12 +01:00
|
|
|
specialArgs = {
|
2025-01-21 12:05:11 +00:00
|
|
|
# NOTE: we shouldn't have to set `specialArgs.lib`,
|
|
|
|
# however see https://github.com/nix-community/nixvim/issues/2879
|
|
|
|
inherit lib;
|
2025-01-17 00:28:36 +00:00
|
|
|
modulesPath = ../modules;
|
2024-09-25 11:01:12 +01:00
|
|
|
# TODO: deprecate `helpers`
|
|
|
|
helpers = self;
|
|
|
|
} // extraSpecialArgs;
|
2024-09-24 07:02:22 +01:00
|
|
|
};
|
2024-08-02 01:26:01 +01:00
|
|
|
}
|
2024-09-25 11:01:12 +01:00
|
|
|
// lib.mapAttrs (
|
|
|
|
name: msg:
|
|
|
|
throw ("`modules.${name}` has been removed." + lib.optionalString (msg != "") (" " + msg))
|
|
|
|
) removed
|