From 5dfd5ecc84d2925bba0eafddc4bcae44ec8ca5e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20He=C3=9F?= Date: Tue, 6 Feb 2024 14:34:08 +0100 Subject: [PATCH 1/3] flutter313: Fix aarch64-darwin --- .../patches/override-host-platform.patch | 2 +- .../flutter/update/get-artifact-hashes.nix.in | 1 + .../compilers/flutter/versions/3_13/data.json | 24 ++++++++++++------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/pkgs/development/compilers/flutter/patches/override-host-platform.patch b/pkgs/development/compilers/flutter/patches/override-host-platform.patch index 51dcfdb5cc57..42c16791a561 100644 --- a/pkgs/development/compilers/flutter/patches/override-host-platform.patch +++ b/pkgs/development/compilers/flutter/patches/override-host-platform.patch @@ -13,7 +13,7 @@ index 1ce1951cef..1bd7602318 100644 + 'x86_64-linux' => HostPlatform.linux_x64, + 'aarch64-linux' => HostPlatform.linux_arm64, + 'x86_64-darwin' => HostPlatform.darwin_x64, -+ 'arm64-darwin' => HostPlatform.darwin_arm64, ++ 'aarch64-darwin' => HostPlatform.darwin_arm64, + String value => throw ArgumentError.value(value, 'NIX_FLUTTER_HOST_PLATFORM', 'Unknown Nix host platform!'), + }; diff --git a/pkgs/development/compilers/flutter/update/get-artifact-hashes.nix.in b/pkgs/development/compilers/flutter/update/get-artifact-hashes.nix.in index 069bcdb95718..73f3b3e1f13e 100644 --- a/pkgs/development/compilers/flutter/update/get-artifact-hashes.nix.in +++ b/pkgs/development/compilers/flutter/update/get-artifact-hashes.nix.in @@ -22,6 +22,7 @@ let "x86_64-linux" "aarch64-linux" "x86_64-darwin" + "aarch64-darwin" ]; derivations = diff --git a/pkgs/development/compilers/flutter/versions/3_13/data.json b/pkgs/development/compilers/flutter/versions/3_13/data.json index 72e002f144d3..7d8f285f0b21 100644 --- a/pkgs/development/compilers/flutter/versions/3_13/data.json +++ b/pkgs/development/compilers/flutter/versions/3_13/data.json @@ -13,42 +13,50 @@ "android": { "x86_64-linux": "sha256-Uc36aBq8wQo2aEvjAPOoixZElWOE/GNRm2GUfhbwT3Y=", "aarch64-linux": "sha256-Uc36aBq8wQo2aEvjAPOoixZElWOE/GNRm2GUfhbwT3Y=", - "x86_64-darwin": "sha256-v/6/GTj7732fEOIgSaoM00yaw2qNwOMuvbuoCvii7vQ=" + "x86_64-darwin": "sha256-v/6/GTj7732fEOIgSaoM00yaw2qNwOMuvbuoCvii7vQ=", + "aarch64-darwin": "sha256-v/6/GTj7732fEOIgSaoM00yaw2qNwOMuvbuoCvii7vQ=" }, "fuchsia": { "x86_64-linux": "sha256-eu0BERdz53CkSexbpu3KA7O6Q4g0s9SGD3t1Snsk3Fk=", "aarch64-linux": "sha256-eu0BERdz53CkSexbpu3KA7O6Q4g0s9SGD3t1Snsk3Fk=", - "x86_64-darwin": "sha256-eu0BERdz53CkSexbpu3KA7O6Q4g0s9SGD3t1Snsk3Fk=" + "x86_64-darwin": "sha256-eu0BERdz53CkSexbpu3KA7O6Q4g0s9SGD3t1Snsk3Fk=", + "aarch64-darwin": "sha256-eu0BERdz53CkSexbpu3KA7O6Q4g0s9SGD3t1Snsk3Fk=" }, "ios": { "x86_64-linux": "sha256-QwkeGnutTVsm682CqxRtEd9rKUvN7zlAJcqkvAQYwao=", "aarch64-linux": "sha256-QwkeGnutTVsm682CqxRtEd9rKUvN7zlAJcqkvAQYwao=", - "x86_64-darwin": "sha256-QwkeGnutTVsm682CqxRtEd9rKUvN7zlAJcqkvAQYwao=" + "x86_64-darwin": "sha256-QwkeGnutTVsm682CqxRtEd9rKUvN7zlAJcqkvAQYwao=", + "aarch64-darwin": "sha256-QwkeGnutTVsm682CqxRtEd9rKUvN7zlAJcqkvAQYwao=" }, "linux": { "x86_64-linux": "sha256-0gIOwux3YBdmcXgwICr8dpftj1CauaBUX8Rt5GG0WSs=", "aarch64-linux": "sha256-drGHsuJoOCLqrhVrXczqJRCOtpeWVlqdWW0OSMS/l5M=", - "x86_64-darwin": "sha256-0gIOwux3YBdmcXgwICr8dpftj1CauaBUX8Rt5GG0WSs=" + "x86_64-darwin": "sha256-0gIOwux3YBdmcXgwICr8dpftj1CauaBUX8Rt5GG0WSs=", + "aarch64-darwin": "sha256-drGHsuJoOCLqrhVrXczqJRCOtpeWVlqdWW0OSMS/l5M=" }, "macos": { "x86_64-linux": "sha256-9WqCJQ37mcGc5tzfqQoY5CqHWHGTizjXf9p73bdnNWc=", "aarch64-linux": "sha256-9WqCJQ37mcGc5tzfqQoY5CqHWHGTizjXf9p73bdnNWc=", - "x86_64-darwin": "sha256-9WqCJQ37mcGc5tzfqQoY5CqHWHGTizjXf9p73bdnNWc=" + "x86_64-darwin": "sha256-9WqCJQ37mcGc5tzfqQoY5CqHWHGTizjXf9p73bdnNWc=", + "aarch64-darwin": "sha256-9WqCJQ37mcGc5tzfqQoY5CqHWHGTizjXf9p73bdnNWc=" }, "universal": { "x86_64-linux": "sha256-wATt1UPjo/fh7RFO1vvcUAdo0dMAaaOUIuzYodsM0v0=", "aarch64-linux": "sha256-Z9bszNaIpCccG7OfvE5WFsw36dITiyCQAZ6p29+Yq68=", - "x86_64-darwin": "sha256-qN5bAXRfQ78TWF3FLBIxWzUB5y5OrZVQTEilY5J/+2k=" + "x86_64-darwin": "sha256-qN5bAXRfQ78TWF3FLBIxWzUB5y5OrZVQTEilY5J/+2k=", + "aarch64-darwin": "sha256-mSpAPKyP9v0dbkXqYkzGOnD5OEjRZigiRElXXcHZ5TE=" }, "web": { "x86_64-linux": "sha256-DVXJOOFxv7tKt3d0NaYMexkphEcr7+gDFV67I6iAYa0=", "aarch64-linux": "sha256-DVXJOOFxv7tKt3d0NaYMexkphEcr7+gDFV67I6iAYa0=", - "x86_64-darwin": "sha256-DVXJOOFxv7tKt3d0NaYMexkphEcr7+gDFV67I6iAYa0=" + "x86_64-darwin": "sha256-DVXJOOFxv7tKt3d0NaYMexkphEcr7+gDFV67I6iAYa0=", + "aarch64-darwin": "sha256-DVXJOOFxv7tKt3d0NaYMexkphEcr7+gDFV67I6iAYa0=" }, "windows": { "x86_64-linux": "sha256-s8fJtwQkuZaGXr6vrPiKfpwP/NfewbETwyp9ERGqHYI=", "aarch64-linux": "sha256-s8fJtwQkuZaGXr6vrPiKfpwP/NfewbETwyp9ERGqHYI=", - "x86_64-darwin": "sha256-s8fJtwQkuZaGXr6vrPiKfpwP/NfewbETwyp9ERGqHYI=" + "x86_64-darwin": "sha256-s8fJtwQkuZaGXr6vrPiKfpwP/NfewbETwyp9ERGqHYI=", + "aarch64-darwin": "sha256-s8fJtwQkuZaGXr6vrPiKfpwP/NfewbETwyp9ERGqHYI=" } }, "pubspecLock": { From db38aeee723be819360d1eb951c9f5988fdfb987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20He=C3=9F?= Date: Sun, 11 Feb 2024 18:00:00 +0100 Subject: [PATCH 2/3] flutter316: Add aarch64-darwin hashes and fix meta.platforms --- pkgs/development/compilers/flutter/flutter.nix | 2 +- .../development/compilers/flutter/versions/3_16/data.json | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/flutter/flutter.nix b/pkgs/development/compilers/flutter/flutter.nix index 42129501ca12..03c2968f4ab9 100644 --- a/pkgs/development/compilers/flutter/flutter.nix +++ b/pkgs/development/compilers/flutter/flutter.nix @@ -136,7 +136,7 @@ let ''; homepage = "https://flutter.dev"; license = licenses.bsd3; - platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ]; + platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; maintainers = with maintainers; [ babariviere ericdallo FlafyDev hacker1024 ]; }; }; diff --git a/pkgs/development/compilers/flutter/versions/3_16/data.json b/pkgs/development/compilers/flutter/versions/3_16/data.json index 100b2bd427d4..afc0225d49a7 100644 --- a/pkgs/development/compilers/flutter/versions/3_16/data.json +++ b/pkgs/development/compilers/flutter/versions/3_16/data.json @@ -13,41 +13,49 @@ "android": { "aarch64-linux": "sha256-j8jstEE1RsTVHJbq6f6We0An+CyJz9JH/YClyNA4mwg=", "x86_64-darwin": "sha256-0FBI0CGMcxyttkzrdyjJlkGAjFd/yMuAQS3pDrNXZZw=", + "aarch64-darwin": "sha256-0FBI0CGMcxyttkzrdyjJlkGAjFd/yMuAQS3pDrNXZZw=", "x86_64-linux": "sha256-j8jstEE1RsTVHJbq6f6We0An+CyJz9JH/YClyNA4mwg=" }, "fuchsia": { "aarch64-linux": "sha256-eu0BERdz53CkSexbpu3KA7O6Q4g0s9SGD3t1Snsk3Fk=", "x86_64-darwin": "sha256-eu0BERdz53CkSexbpu3KA7O6Q4g0s9SGD3t1Snsk3Fk=", + "aarch64-darwin": "sha256-eu0BERdz53CkSexbpu3KA7O6Q4g0s9SGD3t1Snsk3Fk=", "x86_64-linux": "sha256-eu0BERdz53CkSexbpu3KA7O6Q4g0s9SGD3t1Snsk3Fk=" }, "ios": { "aarch64-linux": "sha256-V3VXRX8hn45J+NhzKli+NAc3TGiSoeVQRlJte8DDbZw=", "x86_64-darwin": "sha256-V3VXRX8hn45J+NhzKli+NAc3TGiSoeVQRlJte8DDbZw=", + "aarch64-darwin": "sha256-V3VXRX8hn45J+NhzKli+NAc3TGiSoeVQRlJte8DDbZw=", "x86_64-linux": "sha256-V3VXRX8hn45J+NhzKli+NAc3TGiSoeVQRlJte8DDbZw=" }, "linux": { "aarch64-linux": "sha256-LWpou3L7bAWGn8i4nDT/BZez2Uhf/LbqC2C4Z98hCHQ=", "x86_64-darwin": "sha256-BzjmO4F8B9GagYPbdvoT55r+YgZcP4BUaKgJPGZDXOU=", + "aarch64-darwin": "sha256-LWpou3L7bAWGn8i4nDT/BZez2Uhf/LbqC2C4Z98hCHQ=", "x86_64-linux": "sha256-BzjmO4F8B9GagYPbdvoT55r+YgZcP4BUaKgJPGZDXOU=" }, "macos": { "aarch64-linux": "sha256-BMFqhhy1O1hK33Pj2cxnCAzK9wwHkwT4gNbJ1GaLrnk=", "x86_64-darwin": "sha256-BMFqhhy1O1hK33Pj2cxnCAzK9wwHkwT4gNbJ1GaLrnk=", + "aarch64-darwin": "sha256-BMFqhhy1O1hK33Pj2cxnCAzK9wwHkwT4gNbJ1GaLrnk=", "x86_64-linux": "sha256-BMFqhhy1O1hK33Pj2cxnCAzK9wwHkwT4gNbJ1GaLrnk=" }, "universal": { "aarch64-linux": "sha256-uB2YZRjioP/koMbPvaBHsezjPO0w5a+BpxZaDuiINIY=", "x86_64-darwin": "sha256-Qwf12gMqrW5nDC9Is08oxWTbKMptRQRAIb58JETq3xA=", + "aarch64-darwin": "sha256-Emus5J3mqPv47PD6xqNUD1KpXhVkX4JpURWuYG6KC14=", "x86_64-linux": "sha256-quSFKx7TZRJpK+4YDt5f9jwr7rZsSsaXMxhJ8vIcczQ=" }, "web": { "aarch64-linux": "sha256-rQphVm+T4k5B4OYYw0sJwYBOsNvUOC9fu8IuvXN7hVw=", "x86_64-darwin": "sha256-rQphVm+T4k5B4OYYw0sJwYBOsNvUOC9fu8IuvXN7hVw=", + "aarch64-darwin": "sha256-rQphVm+T4k5B4OYYw0sJwYBOsNvUOC9fu8IuvXN7hVw=", "x86_64-linux": "sha256-rQphVm+T4k5B4OYYw0sJwYBOsNvUOC9fu8IuvXN7hVw=" }, "windows": { "aarch64-linux": "sha256-HL3QLwzze9aO+T/2/xbHqhKV1/ba++MuRnk206hfJdU=", "x86_64-darwin": "sha256-HL3QLwzze9aO+T/2/xbHqhKV1/ba++MuRnk206hfJdU=", + "aarch64-darwin": "sha256-HL3QLwzze9aO+T/2/xbHqhKV1/ba++MuRnk206hfJdU=", "x86_64-linux": "sha256-HL3QLwzze9aO+T/2/xbHqhKV1/ba++MuRnk206hfJdU=" } }, From ab168d1f137db4978501cf592043a304b6c85fe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janne=20He=C3=9F?= Date: Sun, 11 Feb 2024 18:04:14 +0100 Subject: [PATCH 3/3] flutter: Apply multiple Darwin aarch64 fixes Taken from: https://github.com/NixOS/nixpkgs/pull/286750#issuecomment-1935147584 --- .../flutter/artifacts/overrides/darwin.nix | 15 +++++++++++++++ .../compilers/flutter/flutter-tools.nix | 15 +++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/compilers/flutter/artifacts/overrides/darwin.nix diff --git a/pkgs/development/compilers/flutter/artifacts/overrides/darwin.nix b/pkgs/development/compilers/flutter/artifacts/overrides/darwin.nix new file mode 100644 index 000000000000..b03b14f68c8b --- /dev/null +++ b/pkgs/development/compilers/flutter/artifacts/overrides/darwin.nix @@ -0,0 +1,15 @@ +{ darwin }: +{ + buildInputs ? [ ], + ... +}: +{ + postPatch = '' + if [ "$pname" == "flutter-tools" ]; then + # Remove impure references to `arch` and use arm64 instead of arm64e. + substituteInPlace lib/src/ios/xcodeproj.dart \ + --replace-fail /usr/bin/arch '${darwin.adv_cmds}/bin/arch' \ + --replace-fail arm64e arm64 + fi + ''; +} diff --git a/pkgs/development/compilers/flutter/flutter-tools.nix b/pkgs/development/compilers/flutter/flutter-tools.nix index 55fee5630c16..6f8d1b3c1a8f 100644 --- a/pkgs/development/compilers/flutter/flutter-tools.nix +++ b/pkgs/development/compilers/flutter/flutter-tools.nix @@ -1,4 +1,6 @@ -{ systemPlatform +{ lib +, stdenv +, systemPlatform , buildDartApplication , git , which @@ -7,6 +9,7 @@ , flutterSrc , patches ? [ ] , pubspecLock +, darwin }: buildDartApplication.override { inherit dart; } rec { @@ -21,7 +24,15 @@ buildDartApplication.override { inherit dart; } rec { inherit patches; # The given patches are made for the entire SDK source tree. prePatch = ''pushd "$NIX_BUILD_TOP/source"''; - postPatch = ''popd''; + postPatch = '' + popd + '' + # Remove impure references to `arch` and use arm64 instead of arm64e. + + lib.optionalString stdenv.isDarwin '' + substituteInPlace lib/src/ios/xcodeproj.dart \ + --replace-fail /usr/bin/arch '${darwin.adv_cmds}/bin/arch' \ + --replace-fail arm64e arm64 + ''; # When the JIT snapshot is being built, the application needs to run. # It attempts to generate configuration files, and relies on a few external