2023-05-15 11:04:52 +02:00
|
|
|
{
|
2024-12-15 05:23:06 +00:00
|
|
|
lib,
|
2024-12-21 12:58:33 +00:00
|
|
|
flake,
|
|
|
|
_isExtended ? false,
|
2024-02-21 14:40:49 -08:00
|
|
|
_nixvimTests ? false,
|
2024-09-13 14:44:42 +01:00
|
|
|
}:
|
2024-12-21 14:32:05 +00:00
|
|
|
lib.makeExtensible (
|
2024-09-13 14:58:20 +01:00
|
|
|
self:
|
|
|
|
let
|
2024-09-29 14:41:41 +01:00
|
|
|
# Used when importing parts of our lib
|
2024-09-13 14:58:20 +01:00
|
|
|
call = lib.callPackageWith {
|
2024-12-15 05:23:06 +00:00
|
|
|
inherit call self;
|
2024-12-21 12:58:33 +00:00
|
|
|
# TODO: this would be much simpler if `lib` & `self` were kept explicitly separate
|
|
|
|
# Doing so should also improve overridability and simplify bootstrapping.
|
|
|
|
lib = if _isExtended then lib else lib.extend flake.lib.overlay;
|
2024-09-13 14:58:20 +01:00
|
|
|
};
|
|
|
|
in
|
2024-09-20 14:45:33 +01:00
|
|
|
{
|
2024-09-13 14:44:42 +01:00
|
|
|
autocmd = call ./autocmd-helpers.nix { };
|
2024-12-15 05:23:06 +00:00
|
|
|
builders = call ./builders.nix { };
|
2024-09-13 14:44:42 +01:00
|
|
|
deprecation = call ./deprecation.nix { };
|
|
|
|
keymaps = call ./keymap-helpers.nix { };
|
|
|
|
lua = call ./to-lua.nix { };
|
2025-04-24 17:36:16 +01:00
|
|
|
lua-types = call ./lua-types.nix { };
|
2024-12-15 06:51:20 +00:00
|
|
|
modules = call ./modules.nix { inherit flake; };
|
2024-09-13 14:44:42 +01:00
|
|
|
options = call ./options.nix { };
|
2024-12-18 21:03:45 +00:00
|
|
|
plugins = call ./plugins { };
|
2025-05-15 15:49:02 +01:00
|
|
|
utils = call ./utils.nix { inherit _nixvimTests; } // call ./utils.internal.nix { };
|
2024-12-18 21:03:45 +00:00
|
|
|
|
2024-12-15 05:23:06 +00:00
|
|
|
# Top-level helper aliases:
|
|
|
|
# TODO: deprecate some aliases
|
|
|
|
|
2024-09-20 14:45:33 +01:00
|
|
|
inherit (self.builders)
|
|
|
|
writeLua
|
|
|
|
writeByteCompiledLua
|
|
|
|
byteCompileLuaFile
|
|
|
|
byteCompileLuaHook
|
|
|
|
byteCompileLuaDrv
|
|
|
|
;
|
2024-09-13 14:44:42 +01:00
|
|
|
|
2024-09-13 14:58:20 +01:00
|
|
|
inherit (self.deprecation)
|
2024-09-13 14:44:42 +01:00
|
|
|
getOptionRecursive
|
|
|
|
mkDeprecatedSubOptionModule
|
2025-04-06 17:17:51 +02:00
|
|
|
mkRemovedPackageOptionModule
|
2024-09-13 14:44:42 +01:00
|
|
|
mkSettingsRenamedOptionModules
|
|
|
|
transitionType
|
|
|
|
;
|
|
|
|
|
2025-01-18 06:37:02 +00:00
|
|
|
inherit (self.modules)
|
|
|
|
evalNixvim
|
|
|
|
;
|
|
|
|
|
2024-09-13 14:58:20 +01:00
|
|
|
inherit (self.options)
|
2024-09-13 14:44:42 +01:00
|
|
|
defaultNullOpts
|
2024-12-26 07:13:32 -03:00
|
|
|
mkAutoLoadOption
|
2024-09-13 14:44:42 +01:00
|
|
|
mkCompositeOption
|
|
|
|
mkCompositeOption'
|
2024-08-09 02:07:00 -03:00
|
|
|
mkLazyLoadOption
|
2025-01-30 22:53:55 +01:00
|
|
|
mkMaybeUnpackagedOption
|
2024-09-13 14:44:42 +01:00
|
|
|
mkNullOrLua
|
|
|
|
mkNullOrLua'
|
|
|
|
mkNullOrLuaFn
|
|
|
|
mkNullOrLuaFn'
|
|
|
|
mkNullOrOption
|
|
|
|
mkNullOrOption'
|
|
|
|
mkNullOrStr
|
|
|
|
mkNullOrStr'
|
|
|
|
mkNullOrStrLuaFnOr
|
|
|
|
mkNullOrStrLuaFnOr'
|
|
|
|
mkNullOrStrLuaOr
|
|
|
|
mkNullOrStrLuaOr'
|
|
|
|
mkPackageOption
|
|
|
|
mkPluginPackageOption
|
|
|
|
mkSettingsOption
|
2025-01-30 22:53:55 +01:00
|
|
|
mkUnpackagedOption
|
2024-09-13 14:44:42 +01:00
|
|
|
pluginDefaultText
|
|
|
|
;
|
|
|
|
|
2024-09-13 14:58:20 +01:00
|
|
|
inherit (self.utils)
|
2024-12-17 21:18:57 +01:00
|
|
|
applyPrefixToAttrs
|
2024-09-13 14:44:42 +01:00
|
|
|
concatNonEmptyLines
|
|
|
|
emptyTable
|
|
|
|
enableExceptInTests
|
|
|
|
groupListBySize
|
|
|
|
hasContent
|
|
|
|
ifNonNull'
|
|
|
|
listToUnkeyedAttrs
|
2024-11-15 12:55:07 +00:00
|
|
|
literalLua
|
2025-01-20 13:52:53 +01:00
|
|
|
mkAssertions
|
2024-09-13 14:44:42 +01:00
|
|
|
mkIfNonNull
|
|
|
|
mkIfNonNull'
|
|
|
|
mkRaw
|
|
|
|
mkRawKey
|
2025-01-17 16:14:52 +01:00
|
|
|
mkWarnings
|
2024-11-15 13:45:46 +00:00
|
|
|
nestedLiteral
|
|
|
|
nestedLiteralLua
|
2024-09-13 14:44:42 +01:00
|
|
|
override
|
|
|
|
overrideDerivation
|
|
|
|
toRawKeys
|
|
|
|
toSnakeCase
|
|
|
|
upperFirstChar
|
|
|
|
wrapDo
|
|
|
|
wrapLuaForVimscript
|
|
|
|
wrapVimscriptForLua
|
|
|
|
;
|
|
|
|
|
2025-05-15 16:12:26 +01:00
|
|
|
inherit (self.lua) toLuaObject;
|
2024-09-13 14:58:20 +01:00
|
|
|
mkLuaInline = self.lua.mkInline;
|
2024-12-21 12:58:33 +00:00
|
|
|
|
|
|
|
# TODO: Removed 2024-12-21
|
|
|
|
extendedLib = throw "`extendedLib` has been removed. Use `lib.extend <nixvim>.lib.overlay` instead.";
|
2024-09-13 14:58:20 +01:00
|
|
|
}
|
2024-09-27 08:07:20 +01:00
|
|
|
//
|
|
|
|
# TODO: Removed 2024-09-27; remove after 24.11
|
|
|
|
lib.mapAttrs
|
|
|
|
(
|
|
|
|
old: new:
|
|
|
|
throw "The `${old}` alias has been removed. Use `${new}` on a lib with nixvim's extensions."
|
|
|
|
)
|
|
|
|
{
|
|
|
|
maintainers = "lib.maintainers";
|
|
|
|
nixvimTypes = "lib.types";
|
|
|
|
}
|
2024-12-22 10:29:38 +00:00
|
|
|
//
|
|
|
|
# TODO: neovim-plugin & vim-plugin aliases deprecated 2024-12-22; internal functions
|
|
|
|
lib.mapAttrs'
|
|
|
|
(scope: names: {
|
|
|
|
name = "${scope}-plugin";
|
|
|
|
value = lib.genAttrs names (
|
|
|
|
name:
|
|
|
|
lib.warn "`${scope}-plugin.${name}` has been moved to `plugins.${scope}.${name}`."
|
|
|
|
self.plugins.${scope}.${name}
|
|
|
|
);
|
|
|
|
})
|
|
|
|
{
|
|
|
|
neovim = [
|
|
|
|
"extraOptionsOptions"
|
|
|
|
"mkNeovimPlugin"
|
|
|
|
];
|
|
|
|
vim = [
|
|
|
|
"mkSettingsOption"
|
|
|
|
"mkSettingsOptionDescription"
|
|
|
|
"mkVimPlugin"
|
|
|
|
];
|
|
|
|
}
|
2024-09-13 14:58:20 +01:00
|
|
|
)
|