diff --git a/pkgs/development/compilers/flutter/default.nix b/pkgs/development/compilers/flutter/default.nix index c3ef3ab9db4a..6cb28e33d6b8 100644 --- a/pkgs/development/compilers/flutter/default.nix +++ b/pkgs/development/compilers/flutter/default.nix @@ -1,4 +1,4 @@ -{ useNixpkgsEngine ? false, callPackage, fetchzip, fetchFromGitHub, dart, lib, stdenv }@args: +{ useNixpkgsEngine ? false, callPackage, fetchzip, fetchFromGitHub, dart, lib, stdenv }: let mkCustomFlutter = args: callPackage ./flutter.nix args; wrapFlutter = flutter: callPackage ./wrapper.nix { inherit flutter; }; @@ -19,7 +19,7 @@ let , pubspecLock , artifactHashes , channel - }@fargs: + }: let args = { inherit version engineVersion engineSwiftShaderRev engineSwiftShaderHash engineHashes enginePatches patches pubspecLock artifactHashes useNixpkgsEngine channel; diff --git a/pkgs/development/compilers/flutter/sdk-symlink.nix b/pkgs/development/compilers/flutter/sdk-symlink.nix index 044a508805f5..98051efa5613 100644 --- a/pkgs/development/compilers/flutter/sdk-symlink.nix +++ b/pkgs/development/compilers/flutter/sdk-symlink.nix @@ -17,6 +17,28 @@ let if [ -d '${flutter.sdk}/.git' ]; then ln -s '${flutter.sdk}/.git' "$out" fi + + # For iOS/macOS builds, *.xcframework/'s from the pre-built + # artifacts are copied into each built app. However, the symlinkJoin + # means that the *.xcframework's contain symlinks into the nix store, + # which causes issues when actually running the apps. + # + # We'll fix this by only linking to an outer *.xcframework dir instead + # of trying to symlinkJoin the files inside the *.xcframework. + artifactsDir="$out/bin/cache/artifacts/engine" + shopt -s globstar + for file in "$artifactsDir"/**/*.xcframework/Info.plist; do + # Get the unwrapped path from the Info.plist inside each .xcframework + origFile="$(readlink -f "$file")" + origFrameworkDir="$(dirname "$origFile")" + + # Remove the symlinkJoin .xcframework dir and replace it with a symlink + # to the unwrapped .xcframework dir. + frameworkDir="$(dirname "$file")" + rm -r "$frameworkDir" + ln -s "$origFrameworkDir" "$frameworkDir" + done + shopt -u globstar ''; passthru = flutter.passthru // { diff --git a/pkgs/development/compilers/flutter/wrapper.nix b/pkgs/development/compilers/flutter/wrapper.nix index c988eba2e5ae..2c1b1ea125c8 100644 --- a/pkgs/development/compilers/flutter/wrapper.nix +++ b/pkgs/development/compilers/flutter/wrapper.nix @@ -18,7 +18,6 @@ , extraCFlags ? [ ] , extraLinkerFlags ? [ ] , makeWrapper -, runCommandLocal , writeShellScript , wrapGAppsHook3 , git @@ -39,7 +38,6 @@ , cmake , ninja , clang -, lndir , symlinkJoin }: @@ -56,7 +54,7 @@ let }; })); - cacheDir = symlinkJoin rec { + cacheDir = symlinkJoin { name = "flutter-cache-dir"; paths = builtins.attrValues flutterPlatformArtifacts; postBuild = ''