Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 callPackage, 3 hostPlatform, 4 targetPlatform, 5 fetchgit, 6 tools ? callPackage ./tools.nix { inherit hostPlatform; }, 7 curl, 8 pkg-config, 9 git, 10 python3, 11 runCommand, 12 writeText, 13 cacert, 14 version, 15 hashes, 16 url, 17}: 18let 19 constants = callPackage ./constants.nix { inherit targetPlatform; }; 20 boolOption = value: if value then "True" else "False"; 21in 22runCommand "flutter-engine-source-${version}-${targetPlatform.system}" 23 { 24 pname = "flutter-engine-source"; 25 inherit version; 26 27 inherit (tools) depot_tools; 28 29 nativeBuildInputs = [ 30 curl 31 pkg-config 32 git 33 tools.cipd 34 (python3.withPackages ( 35 ps: with ps; [ 36 httplib2 37 six 38 ] 39 )) 40 ]; 41 42 gclient = writeText "flutter-engine-${version}.gclient" '' 43 solutions = [{ 44 "managed": False, 45 "name": "src/flutter", 46 "url": "${url}", 47 "custom_vars": { 48 "download_fuchsia_deps": False, 49 "download_android_deps": False, 50 "download_linux_deps": ${boolOption targetPlatform.isLinux}, 51 "setup_githooks": False, 52 "download_esbuild": False, 53 "download_dart_sdk": False, 54 }, 55 }] 56 ''; 57 58 NIX_SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; 59 GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt"; 60 SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt"; 61 DEPOT_TOOLS_UPDATE = "0"; 62 DEPOT_TOOLS_COLLECT_METRICS = "0"; 63 PYTHONDONTWRITEBYTECODE = "1"; 64 65 outputHashAlgo = "sha256"; 66 outputHashMode = "recursive"; 67 outputHash = hashes.${targetPlatform.system} or (throw "Hash not set for ${targetPlatform.system}"); 68 } 69 '' 70 source ${../../../../build-support/fetchgit/deterministic-git} 71 export -f clean_git 72 export -f make_deterministic_repo 73 74 mkdir -p $out 75 cp $gclient $out/.gclient 76 cd $out 77 78 export PATH=$PATH:$depot_tools 79 python3 $depot_tools/gclient.py sync --no-history --shallow --nohooks 2>&1 >/dev/null 80 find $out -name '.git' -exec dirname {} \; | xargs bash -c 'make_deterministic_repo $@' _ 81 find $out -path '*/.git/*' ! -name 'HEAD' -prune -exec rm -rf {} \; 82 find $out -name '.git' -exec mkdir {}/logs \; 83 find $out -name '.git' -exec cp {}/HEAD {}/logs/HEAD \; 84 85 rm -rf $out/src/flutter/{buildtools,prebuilts,third_party/swiftshader} 86 87 rm -rf $out/.cipd $out/.gclient $out/.gclient_entries $out/.gclient_previous_custom_vars $out/.gclient_previous_sync_commits 88 ''