1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-12-10 19:11:08 +01:00

lib: reimplement call; drop .override

Using `callPackageWith` adds `override` and `overrideDerivation`
attributes to the result, which are not relevant to subsections of
Nixvim's lib section.

Implement our own, simplified, `call` using `intersectAttrs` and
`functionArgs`.

If users wish to modify parts of our lib section, they should extend the
top-level fixpoint to ensure everything stays in sync.
This commit is contained in:
Matt Sturgeon 2025-12-05 11:37:49 +00:00
parent 8e85c25143
commit 085f50eac5

View file

@ -22,13 +22,21 @@ lib.makeExtensible (
self: self:
let let
# Used when importing parts of our lib # Used when importing parts of our lib
call = lib.callPackageWith { autoArgs = {
inherit inherit
call call
self self
lib lib
; ;
}; };
call =
fnOrFile:
let
fn = if builtins.isPath fnOrFile then import fnOrFile else fnOrFile;
fnAutoArgs = builtins.intersectAttrs (builtins.functionArgs fn) autoArgs;
in
args: fn (fnAutoArgs // args);
in in
{ {
autocmd = call ./autocmd-helpers.nix { }; autocmd = call ./autocmd-helpers.nix { };