Skip to content

Commit

Permalink
lib/types: merge into extendedLib
Browse files Browse the repository at this point in the history
  • Loading branch information
MattSturgeon committed Aug 21, 2024
1 parent 38b09c1 commit b414a53
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
9 changes: 8 additions & 1 deletion lib/extend-lib.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# Extends nixpkg's lib with our functions, as expected by our modules
{ lib, helpers }:
{
call,
lib,
helpers,
}:
lib.extend (
final: prev: {
# Include our custom lib
nixvim = helpers;

# Merge in our maintainers
maintainers = prev.maintainers // import ./maintainers.nix;

# Merge in our custom types
types = call ./types.nix { } // prev.types;
}
)
6 changes: 4 additions & 2 deletions lib/helpers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
# Used when importing parts of helpers
call = lib.callPackageWith {
# TODO: deprecate/remove using `helpers` in the subsections
inherit pkgs helpers;
inherit call pkgs helpers;
lib = helpers.extendedLib;
};

Expand All @@ -22,7 +22,6 @@ let
lua = call ./to-lua.nix { };
modules = call ./modules.nix { };
neovim-plugin = call ./neovim-plugin.nix { };
nixvimTypes = call ./types.nix { };
options = call ./options.nix { };
utils = call ./utils.nix { inherit _nixvimTests; };
vim-plugin = call ./vim-plugin.nix { };
Expand Down Expand Up @@ -92,6 +91,9 @@ let
# 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;
};
Expand Down
3 changes: 1 addition & 2 deletions lib/types.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Custom types to be included in `lib.types`
{ lib, helpers }:
with lib;
with helpers;
Expand Down Expand Up @@ -91,5 +92,3 @@ rec {
}";
};
}
# Allow to do `with nixvimTypes;` instead of `with types;`
// lib.types

0 comments on commit b414a53

Please sign in to comment.