Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 24.05-beta 58 lines 1.5 kB view raw
1{ lib 2, stdenv 3, systemPlatform 4, buildDartApplication 5, git 6, which 7, dart 8, version 9, flutterSrc 10, patches ? [ ] 11, pubspecLock 12}: 13 14buildDartApplication.override { inherit dart; } rec { 15 pname = "flutter-tools"; 16 inherit version; 17 dartOutputType = "jit-snapshot"; 18 19 src = flutterSrc; 20 sourceRoot = "${src.name}/packages/flutter_tools"; 21 postUnpack = ''chmod -R u+w "$NIX_BUILD_TOP/source"''; 22 23 inherit patches; 24 # The given patches are made for the entire SDK source tree. 25 prePatch = ''pushd "$NIX_BUILD_TOP/source"''; 26 postPatch = '' 27 popd 28 '' 29 # Use arm64 instead of arm64e. 30 + lib.optionalString stdenv.isDarwin '' 31 substituteInPlace lib/src/ios/xcodeproj.dart \ 32 --replace-fail arm64e arm64 33 ''; 34 35 # When the JIT snapshot is being built, the application needs to run. 36 # It attempts to generate configuration files, and relies on a few external 37 # tools. 38 nativeBuildInputs = [ git which ]; 39 preConfigure = '' 40 export HOME=. 41 export FLUTTER_ROOT="$NIX_BUILD_TOP/source" 42 mkdir -p "$FLUTTER_ROOT/bin/cache" 43 ln -s '${dart}' "$FLUTTER_ROOT/bin/cache/dart-sdk" 44 ''; 45 46 dartEntryPoints."flutter_tools.snapshot" = "bin/flutter_tools.dart"; 47 dartCompileFlags = [ "--define=NIX_FLUTTER_HOST_PLATFORM=${systemPlatform}" ]; 48 49 # The Dart wrapper launchers are useless for the Flutter tool - it is designed 50 # to be launched from a snapshot by the SDK. 51 postInstall = '' 52 pushd "$out" 53 rm ${builtins.concatStringsSep " " (builtins.attrNames dartEntryPoints)} 54 popd 55 ''; 56 57 inherit pubspecLock; 58}