diff --git a/nix/internal/any-darwin.nix b/nix/internal/any-darwin.nix index a6f75086f2..e8b0380fdd 100644 --- a/nix/internal/any-darwin.nix +++ b/nix/internal/any-darwin.nix @@ -81,7 +81,7 @@ in rec { patchShebangs . >/dev/null # a real lot of paths to patch, no need to litter logs # This is building against Node.js, not Electron, but it still will fail, unless: - ourArch="$(uname -m)" + ourArch="${__head (__split "-" targetSystem)}" for f in \ node_modules/usb/binding.gyp \ node_modules/usb/libusb.gypi \ diff --git a/scripts/rebuild-native-modules.sh b/scripts/rebuild-native-modules.sh index 6da56d41e1..4b2e089033 100755 --- a/scripts/rebuild-native-modules.sh +++ b/scripts/rebuild-native-modules.sh @@ -20,8 +20,9 @@ nix run -L .#internal."${system:-x86_64-darwin}".common.patchElectronRebuild # XXX: Electron 24.2 requires c++17, not 14 (or old 1y): sed -r 's,std=c\+\+(14|1y),std=c++17,g' -i node_modules/usb/binding.gyp -if [ "$(uname)" == "Darwin" ] ; then - ourArch="$(uname -m)" + +if [ "$(cut -d- -f2 <<<"${system:-x86_64-darwin}")" == "darwin" ] ; then + ourArch="$(cut -d- -f1 <<<"${system:-x86_64-darwin}")" for f in \ node_modules/usb/binding.gyp \ node_modules/usb/libusb.gypi \ @@ -37,7 +38,7 @@ electron-rebuild --force electron-rebuild -w usb-detection --force -s # -if [ "$(uname)" == "Linux" ] ; then +if [ "$(cut -d- -f2 <<<"${system:-x86_64-darwin}")" == "linux" ] ; then # We ship debug version because the release one has issues with Ledger Nano S electron-rebuild -w usb --force -s --debug fi @@ -76,6 +77,6 @@ tryLink "usb-detection" "detection.node" tryLink "utf-8-validate" "validation.node" tryLink "node-hid" "HID.node" -if [ "$(uname)" == "Linux" ] ; then +if [ "$(cut -d- -f2 <<<"${system:-x86_64-darwin}")" == "linux" ] ; then tryLink "node-hid" "HID_hidraw.node" fi