Skip to content

Commit 8cc33f9

Browse files
authored
Unconditionally evaluate hook.extra as a function (#61)
In NixOS/nixpkgs#386208, function arguments are preserved in some circumstances. This caused issues such as divnix/std#399. Ultimately, it comes down to the `builtins.isFunction` check, which does not detect functors. With this patch, `hook.extra` is coerced to a function unconditionally. If it is a constant, any arguments are ignored, so behaviour does not change.
1 parent 5133633 commit 8cc33f9

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

lib/make.nix

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ in
3737
hook =
3838
userRequest.hook
3939
// {
40-
extra =
41-
if builtins.isFunction userRequest.hook.extra
42-
then userRequest.hook.extra userRequest.data
43-
else userRequest.hook.extra;
40+
extra = (pkgs.lib.toFunction userRequest.hook.extra) userRequest.data;
4441
};
4542
};
4643

0 commit comments

Comments
 (0)