Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 24.05-beta 73 lines 1.8 kB view raw
1# Schema: 2# ${flutterVersion}.${targetPlatform}.${hostPlatform} 3# 4# aarch64-darwin as a host is not yet supported. 5# https://github.com/flutter/flutter/issues/60118 6{ lib 7, runCommand 8, xorg 9, cacert 10, unzip 11 12, flutterPlatform 13, systemPlatform 14, flutter 15, hash 16}: 17 18let 19 flutterPlatforms = [ 20 "android" 21 "ios" 22 "web" 23 "linux" 24 "windows" 25 "macos" 26 "fuchsia" 27 "universal" 28 ]; 29 30 flutter' = flutter.override { 31 # Use a version of Flutter with just enough capabilities to download 32 # artifacts. 33 supportedTargetFlutterPlatforms = [ ]; 34 35 # Modify flutter-tool's system platform in order to get the desired platform's hashes. 36 flutter = flutter.unwrapped.override { 37 flutterTools = flutter.unwrapped.tools.override { 38 inherit systemPlatform; 39 }; 40 }; 41 }; 42in 43runCommand "flutter-artifacts-${flutterPlatform}-${systemPlatform}" 44{ 45 nativeBuildInputs = [ xorg.lndir flutter' unzip ]; 46 47 NIX_FLUTTER_TOOLS_VM_OPTIONS = "--root-certs-file=${cacert}/etc/ssl/certs/ca-bundle.crt"; 48 NIX_FLUTTER_OPERATING_SYSTEM = { 49 "x86_64-linux" = "linux"; 50 "aarch64-linux" = "linux"; 51 "x86_64-darwin" = "macos"; 52 "aarch64-darwin" = "macos"; 53 }.${systemPlatform}; 54 55 outputHash = hash; 56 outputHashMode = "recursive"; 57 outputHashAlgo = "sha256"; 58 59 passthru = { 60 inherit flutterPlatform; 61 }; 62} '' 63 export FLUTTER_ROOT="$NIX_BUILD_TOP" 64 lndir -silent '${flutter'}' "$FLUTTER_ROOT" 65 rm -rf "$FLUTTER_ROOT/bin/cache" 66 mkdir "$FLUTTER_ROOT/bin/cache" 67 68 HOME="$(mktemp -d)" flutter precache -v '--${flutterPlatform}' ${builtins.concatStringsSep " " (map (p: "'--no-${p}'") (lib.remove flutterPlatform flutterPlatforms))} 69 rm -rf "$FLUTTER_ROOT/bin/cache/lockfile" 70 find "$FLUTTER_ROOT" -type l -lname '${flutter'}/*' -delete 71 72 cp -r bin/cache "$out" 73''