lib: use lib.fix and self internally

This commit is contained in:
Matt Sturgeon 2024-09-13 14:58:20 +01:00
parent 7a147234f8
commit f47e8f8f79
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
2 changed files with 24 additions and 23 deletions

View file

@ -4,16 +4,18 @@
_nixvimTests ? false, _nixvimTests ? false,
... ...
}: }:
let # Build helpers recursively
lib.fix (
self:
let
# Used when importing parts of helpers # Used when importing parts of helpers
call = lib.callPackageWith { call = lib.callPackageWith {
# TODO: deprecate/remove using `helpers` in the subsections inherit call pkgs self;
inherit call pkgs helpers; helpers = self; # TODO: stop using `helpers` in the subsections
lib = helpers.extendedLib; lib = self.extendedLib;
}; };
in
# Build helpers recursively {
helpers = {
autocmd = call ./autocmd-helpers.nix { }; autocmd = call ./autocmd-helpers.nix { };
builders = call ./builders.nix { }; builders = call ./builders.nix { };
deprecation = call ./deprecation.nix { }; deprecation = call ./deprecation.nix { };
@ -29,7 +31,7 @@ let
# Top-level helper aliases: # Top-level helper aliases:
# TODO: deprecate some aliases # TODO: deprecate some aliases
inherit (helpers.builders) inherit (self.builders)
writeLua writeLua
writeByteCompiledLua writeByteCompiledLua
byteCompileLuaFile byteCompileLuaFile
@ -37,14 +39,14 @@ let
byteCompileLuaDrv byteCompileLuaDrv
; ;
inherit (helpers.deprecation) inherit (self.deprecation)
getOptionRecursive getOptionRecursive
mkDeprecatedSubOptionModule mkDeprecatedSubOptionModule
mkSettingsRenamedOptionModules mkSettingsRenamedOptionModules
transitionType transitionType
; ;
inherit (helpers.options) inherit (self.options)
defaultNullOpts defaultNullOpts
mkCompositeOption mkCompositeOption
mkCompositeOption' mkCompositeOption'
@ -66,7 +68,7 @@ let
pluginDefaultText pluginDefaultText
; ;
inherit (helpers.utils) inherit (self.utils)
concatNonEmptyLines concatNonEmptyLines
emptyTable emptyTable
enableExceptInTests enableExceptInTests
@ -89,13 +91,12 @@ let
; ;
# TODO: Deprecate this `maintainers` alias # TODO: Deprecate this `maintainers` alias
inherit (helpers.extendedLib) maintainers; inherit (self.extendedLib) maintainers;
# TODO: Deprecate the old `nixvimTypes` alias? # TODO: Deprecate the old `nixvimTypes` alias?
nixvimTypes = helpers.extendedLib.types; nixvimTypes = self.extendedLib.types;
toLuaObject = helpers.lua.toLua; toLuaObject = self.lua.toLua;
mkLuaInline = helpers.lua.mkInline; mkLuaInline = self.lua.mkInline;
}; }
in )
helpers

View file

@ -2,12 +2,12 @@
{ {
call, call,
lib, lib,
helpers, self,
}: }:
lib.extend ( lib.extend (
final: prev: { final: prev: {
# Include our custom lib # Include our custom lib
nixvim = helpers; nixvim = self;
# Merge in our maintainers # Merge in our maintainers
maintainers = prev.maintainers // import ./maintainers.nix; maintainers = prev.maintainers // import ./maintainers.nix;