Skip to content

Commit 27122aa

Browse files
committed
[DDW-1213] Don’t hardcode the path to @electron/rebuild
1 parent dc79bff commit 27122aa

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

nix/x86_64-windows.nix

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ in rec {
151151
};
152152

153153
msvc-cache = let
154-
version = "16";
154+
version = "16"; # There doesn’t seem to be an easy way to specify a more stable full version, 16.11.26
155155
in pkgs.stdenv.mkDerivation {
156156
name = "msvc-cache-${version}";
157157
inherit version;
@@ -216,13 +216,6 @@ in rec {
216216
unifont winePackages.fonts xorg.fontcursormisc xorg.fontmiscmisc
217217
];
218218
};
219-
patchedPackageJson = pkgs.writeText "package.json" (builtins.toJSON (
220-
pkgs.lib.recursiveUpdate originalPackageJson {
221-
scripts = {
222-
"build:electron:windows" = "node.exe .\\node_modules\\@electron\\rebuild\\lib\\cli.js -f -w usb";
223-
};
224-
}
225-
));
226219
buildPhase = let
227220
mkSection = title: ''
228221
echo ' '
@@ -324,7 +317,15 @@ in rec {
324317
"$(winepath -w ${electronHeadersWithNodeLib} | sed -r 's,\\,\\\\\\\\,g')"
325318
326319
${mkSection "Running @electron/rebuild"}
327-
cp $patchedPackageJson package.json
320+
# XXX: we need to run the command with the Node.js env set correcty, `npm.cmd` does that:
321+
export electron_rebuild_bin="$(winepath -w "$(readlink -f node_modules/.bin/electron-rebuild)")"
322+
cp ${pkgs.writeText "package.json" (builtins.toJSON (
323+
pkgs.lib.recursiveUpdate originalPackageJson {
324+
scripts = {
325+
"build:electron:windows" = "node.exe %electron_rebuild_bin% -f -w usb";
326+
};
327+
}
328+
))} package.json
328329
wine npm.cmd run build:electron:windows
329330
''}
330331
'';

0 commit comments

Comments
 (0)