Skip to content

Commit 085f50e

Browse files
committed
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.
1 parent 8e85c25 commit 085f50e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/top-level.nix

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,21 @@ lib.makeExtensible (
2222
self:
2323
let
2424
# Used when importing parts of our lib
25-
call = lib.callPackageWith {
25+
autoArgs = {
2626
inherit
2727
call
2828
self
2929
lib
3030
;
3131
};
32+
33+
call =
34+
fnOrFile:
35+
let
36+
fn = if builtins.isPath fnOrFile then import fnOrFile else fnOrFile;
37+
fnAutoArgs = builtins.intersectAttrs (builtins.functionArgs fn) autoArgs;
38+
in
39+
args: fn (fnAutoArgs // args);
3240
in
3341
{
3442
autocmd = call ./autocmd-helpers.nix { };

0 commit comments

Comments
 (0)