lib: rename helpers.nix -> default.nix

The old `default.nix` is inlined into the "lib" flake-module, which is
the only place it was used.

This allows "helpers" to take its rightful place at the root of `./lib` 👑
This commit is contained in:
Matt Sturgeon 2024-09-13 14:44:42 +01:00
parent 0b665b200b
commit 7a147234f8
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
9 changed files with 116 additions and 122 deletions

View file

@ -1,12 +1,101 @@
# Args probably only needs pkgs and lib
{
pkgs,
lib ? pkgs.lib,
_nixvimTests ? false,
...
}@args:
{
# Add all exported modules here
check = import ./tests.nix { inherit lib pkgs; };
helpers = import ./helpers.nix (args // { inherit _nixvimTests; });
}
}:
let
# Used when importing parts of helpers
call = lib.callPackageWith {
# TODO: deprecate/remove using `helpers` in the subsections
inherit call pkgs helpers;
lib = helpers.extendedLib;
};
# Build helpers recursively
helpers = {
autocmd = call ./autocmd-helpers.nix { };
builders = call ./builders.nix { };
deprecation = call ./deprecation.nix { };
extendedLib = call ./extend-lib.nix { inherit lib; };
keymaps = call ./keymap-helpers.nix { };
lua = call ./to-lua.nix { };
modules = call ./modules.nix { };
neovim-plugin = call ./neovim-plugin.nix { };
options = call ./options.nix { };
utils = call ./utils.nix { inherit _nixvimTests; };
vim-plugin = call ./vim-plugin.nix { };
# Top-level helper aliases:
# TODO: deprecate some aliases
inherit (helpers.builders)
writeLua
writeByteCompiledLua
byteCompileLuaFile
byteCompileLuaHook
byteCompileLuaDrv
;
inherit (helpers.deprecation)
getOptionRecursive
mkDeprecatedSubOptionModule
mkSettingsRenamedOptionModules
transitionType
;
inherit (helpers.options)
defaultNullOpts
mkCompositeOption
mkCompositeOption'
mkNullOrLua
mkNullOrLua'
mkNullOrLuaFn
mkNullOrLuaFn'
mkNullOrOption
mkNullOrOption'
mkNullOrStr
mkNullOrStr'
mkNullOrStrLuaFnOr
mkNullOrStrLuaFnOr'
mkNullOrStrLuaOr
mkNullOrStrLuaOr'
mkPackageOption
mkPluginPackageOption
mkSettingsOption
pluginDefaultText
;
inherit (helpers.utils)
concatNonEmptyLines
emptyTable
enableExceptInTests
groupListBySize
hasContent
ifNonNull'
listToUnkeyedAttrs
mkIfNonNull
mkIfNonNull'
mkRaw
mkRawKey
override
overrideDerivation
toRawKeys
toSnakeCase
upperFirstChar
wrapDo
wrapLuaForVimscript
wrapVimscriptForLua
;
# TODO: Deprecate this `maintainers` alias
inherit (helpers.extendedLib) maintainers;
# TODO: Deprecate the old `nixvimTypes` alias?
nixvimTypes = helpers.extendedLib.types;
toLuaObject = helpers.lua.toLua;
mkLuaInline = helpers.lua.mkInline;
};
in
helpers