Skip to content

Commit e337f39

Browse files
authored
Merge pull request #175 from BirdeeHub/makeWrapper
refactor(modules.makeWrapper): contain wrapperFunction logic to wrapperFunction
2 parents 3d4986c + b04a431 commit e337f39

File tree

5 files changed

+450
-434
lines changed

5 files changed

+450
-434
lines changed

lib/core.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
lib,
55
wlib,
66
extendModules,
7+
# NOTE: makes sure builderFunction and wrapperFunction get name from _module.args
8+
name ? null,
79
...
810
}@args:
911
let

modules/makeWrapper/default.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{ config, callPackage, ... }@args:
2+
callPackage (
3+
if config.wrapperImplementation or "nix" == "nix" then ./makeWrapperNix.nix else ./makeWrapper.nix
4+
) args

modules/makeWrapper/makeWrapper.nix

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
config,
33
wlib,
44
lib,
5+
makeWrapper,
6+
makeBinaryWrapper,
7+
dieHook,
58
...
69
}:
710
let
@@ -117,8 +120,16 @@ let
117120
))
118121
lib.flatten
119122
];
123+
124+
srcsetup = p: "source ${lib.escapeShellArg "${p}/nix-support/setup-hook"}";
120125
in
121126
if config.binName == "" then
122127
""
123128
else
124-
"makeWrapper ${baseArgs} ${builtins.concatStringsSep " " resArgs}"
129+
''
130+
$(
131+
${srcsetup dieHook}
132+
${srcsetup (if config.wrapperImplementation == "shell" then makeWrapper else makeBinaryWrapper)}
133+
makeWrapper ${baseArgs} ${builtins.concatStringsSep " " resArgs}
134+
)
135+
''

0 commit comments

Comments
 (0)