Fix macOS build on Nix-provided Flutter

This commit is contained in:
Erwan Leboucher 2026-08-08 22:15:23 +02:00
commit d753dc2261
Signed by: eleboucher
SSH key fingerprint: SHA256:fjyYE6Mo6r2wpEtyYKFfGpX8fmR9bjL0NxWBHosnOgk
2 changed files with 17 additions and 2 deletions

View file

@ -349,7 +349,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
shellScript = "export PATH=\"$PROJECT_DIR/scripts:$PATH\"\necho \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
};
33CC111E2044C6BF0003C045 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@ -369,7 +369,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
shellScript = "export PATH=\"$PROJECT_DIR/scripts:$PATH\"\n\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
};
446C82D5FE82BD05F78EDA6A /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;

15
macos/scripts/lipo Executable file
View file

@ -0,0 +1,15 @@
#!/bin/sh
# Workaround for NixOS/nixpkgs#405066: frameworks copied from the Nix store
# stay read-only, so lipo can't write its temporary output file when Flutter
# thins FlutterMacOS.framework during the build. Make the framework writable
# before delegating to the real lipo.
for arg in "$@"; do
case "$arg" in
*/*.framework/*)
fw_dir="${arg%.framework/*}.framework"
chmod -R +w "$fw_dir" 2>/dev/null
;;
esac
done
exec /usr/bin/lipo "$@"