push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
{ lib, platform }:
let
self = {
os =
if platform.isLinux then
"linux"
else if platform.isDarwin then
"macos"
else if platform.isWindows then
"windows"
else
throw "Unsupported OS \"${platform.parsed.kernel.name}\"";
alt-os = if platform.isDarwin then "mac" else self.os;
arch =
if platform.isx86_64 then
"amd64"
else if platform.isx86 && platform.is32bit then
"386"
else if platform.isAarch64 then
"arm64"
else if platform.isMips && platform.parsed.cpu.significantByte == "littleEndian" then
"mipsle"
else if platform.isMips64 then
"mips64${lib.optionalString (platform.parsed.cpu.significantByte == "littleEndian") "le"}"
else if platform.isPower64 then
"ppc64${lib.optionalString (platform.parsed.cpu.significantByte == "littleEndian") "le"}"
else if platform.isS390x then
"s390x"
else if platform.isRiscV64 then
"riscv64"
else
throw "Unsupported CPU \"${platform.parsed.cpu.name}\"";
alt-arch =
if platform.isx86_64 then
"x64"
else if platform.isAarch64 then
"arm64"
else
platform.parsed.cpu.name;
platform = "${self.os}-${self.arch}";
alt-platform = "${self.os}-${self.alt-arch}";
};
in
self

View File

@@ -0,0 +1,15 @@
{ engine, runCommand }:
runCommand "flutter-engine-${engine.version}-dart"
{
version = engine.dartSdkVersion;
inherit engine;
inherit (engine) outName;
meta = engine.meta // {
description = "Dart SDK compiled from the Flutter Engine";
};
}
''
ln -s ${engine}/out/$outName/dart-sdk $out
''

View File

@@ -0,0 +1,76 @@
{
callPackage,
dartSdkVersion,
flutterVersion,
swiftshaderHash,
swiftshaderRev,
version,
hashes,
url,
patches,
runtimeModes,
isOptimized ? null,
lib,
stdenv,
dart,
mainRuntimeMode ? null,
altRuntimeMode ? null,
}@args:
let
mainRuntimeMode = args.mainRuntimeMode or builtins.elemAt runtimeModes 0;
altRuntimeMode = args.altRuntimeMode or builtins.elemAt runtimeModes 1;
runtimeModesBuilds = lib.genAttrs runtimeModes (
runtimeMode:
callPackage ./package.nix {
inherit
dartSdkVersion
flutterVersion
swiftshaderHash
swiftshaderRev
version
hashes
url
patches
runtimeMode
;
isOptimized = args.isOptimized or runtimeMode != "debug";
}
);
in
stdenv.mkDerivation (
{
pname = "flutter-engine";
inherit url runtimeModes;
inherit (runtimeModesBuilds.${mainRuntimeMode})
meta
src
version
dartSdkVersion
isOptimized
runtimeMode
outName
dart
swiftshader
;
inherit altRuntimeMode;
dontUnpack = true;
dontBuild = true;
installPhase = ''
mkdir -p $out/out
''
+ lib.concatMapStrings (
runtimeMode:
let
runtimeModeBuild = runtimeModesBuilds.${runtimeMode};
runtimeModeOut = runtimeModeBuild.outName;
in
''
ln -sf ${runtimeModeBuild}/out/${runtimeModeOut} $out/out/${runtimeModeOut}
''
) runtimeModes;
}
// runtimeModesBuilds
)

View File

@@ -0,0 +1,364 @@
{
lib,
callPackage,
writeText,
symlinkJoin,
darwin,
clang,
llvm,
tools ? callPackage ./tools.nix {
inherit (stdenv)
hostPlatform
buildPlatform
;
},
stdenv,
stdenvNoCC,
dart,
fetchgit,
runCommand,
llvmPackages,
patchelf,
openbox,
xorg,
libglvnd,
libepoxy,
wayland,
freetype,
pango,
glib,
harfbuzz,
cairo,
gdk-pixbuf,
at-spi2-atk,
zlib,
gtk3,
pkg-config,
ninja,
python312,
gitMinimal,
version,
flutterVersion,
dartSdkVersion,
swiftshaderHash,
swiftshaderRev,
hashes,
patches,
url,
runtimeMode ? "release",
isOptimized ? runtimeMode != "debug",
}:
let
expandSingleDep =
dep: lib.optionals (lib.isDerivation dep) ([ dep ] ++ map (output: dep.${output}) dep.outputs);
expandDeps = deps: lib.flatten (map expandSingleDep deps);
constants = callPackage ./constants.nix { platform = stdenv.targetPlatform; };
python3 = python312;
src = callPackage ./source.nix {
inherit
tools
flutterVersion
version
hashes
url
;
inherit (stdenv)
hostPlatform
buildPlatform
targetPlatform
;
};
swiftshader = fetchgit {
url = "https://swiftshader.googlesource.com/SwiftShader.git";
hash = swiftshaderHash;
rev = swiftshaderRev;
postFetch = ''
rm -rf $out/third_party/llvm-project
'';
};
llvm = symlinkJoin {
name = "llvm";
paths = [
clang
llvmPackages.llvm
];
};
outName = "host_${runtimeMode}${lib.optionalString (!isOptimized) "_unopt"}";
dartPath = "${
if (lib.versionAtLeast flutterVersion "3.23") then "flutter/third_party" else "third_party"
}/dart";
in
stdenv.mkDerivation (finalAttrs: {
pname = "flutter-engine-${runtimeMode}${lib.optionalString (!isOptimized) "-unopt"}";
inherit
version
runtimeMode
patches
isOptimized
dartSdkVersion
src
outName
swiftshader
;
setOutputFlags = false;
doStrip = isOptimized;
toolchain = symlinkJoin {
name = "flutter-engine-toolchain-${version}";
paths =
expandDeps (
lib.optionals (stdenv.hostPlatform.isLinux) [
gtk3
wayland
libepoxy
libglvnd
freetype
at-spi2-atk
glib
gdk-pixbuf
harfbuzz
pango
cairo
xorg.libxcb
xorg.libX11
xorg.libXcursor
xorg.libXrandr
xorg.libXrender
xorg.libXinerama
xorg.libXi
xorg.libXext
xorg.libXfixes
xorg.libXxf86vm
xorg.xorgproto
zlib
]
++ lib.optionals (stdenv.hostPlatform.isDarwin) [
clang
llvm
]
)
++ [
stdenv.cc.libc_dev
stdenv.cc.libc_lib
];
# Needed due to Flutter expecting everything to be relative to $out
# and not true absolute path (ie relative to "/").
postBuild = ''
mkdir -p $(dirname $(dirname "$out/$out"))
ln -s $(dirname "$out") $out/$(dirname "$out")
'';
};
NIX_CFLAGS_COMPILE = [
"-I${finalAttrs.toolchain}/include"
]
++ lib.optional (!isOptimized) "-U_FORTIFY_SOURCE"
++ lib.optionals (lib.versionAtLeast flutterVersion "3.35") [
"-Wno-macro-redefined"
"-Wno-error=macro-redefined"
];
nativeCheckInputs = lib.optionals stdenv.hostPlatform.isLinux [
xorg.xorgserver
openbox
];
nativeBuildInputs = [
(python3.withPackages (
ps: with ps; [
pyyaml
]
))
(tools.vpython python3)
gitMinimal
pkg-config
ninja
dart
]
++ lib.optionals (stdenv.hostPlatform.isLinux) [ patchelf ]
++ lib.optionals (stdenv.hostPlatform.isDarwin) [
darwin.system_cmds
darwin.xcode
tools.xcode-select
]
++ lib.optionals (stdenv.cc.libc ? bin) [ stdenv.cc.libc.bin ];
buildInputs = [ gtk3 ];
patchtools = [ "flutter/third_party/gn/gn" ];
dontPatch = true;
patchgit = [
dartPath
"flutter"
"."
]
++ lib.optional (lib.versionAtLeast flutterVersion "3.21") "flutter/third_party/skia";
postUnpack = ''
pushd ${src.name}
cp ${./pkg-config.py} src/build/config/linux/pkg-config.py
cp -pr --reflink=auto $swiftshader src/flutter/third_party/swiftshader
chmod -R u+w -- src/flutter/third_party/swiftshader
ln -s ${llvmPackages.llvm.monorepoSrc} src/flutter/third_party/swiftshader/third_party/llvm-project
mkdir -p src/flutter/buildtools/${constants.alt-platform}
ln -s ${llvm} src/flutter/buildtools/${constants.alt-platform}/clang
mkdir -p src/buildtools/${constants.alt-platform}
ln -s ${llvm} src/buildtools/${constants.alt-platform}/clang
mkdir -p src/${dartPath}/tools/sdks
ln -s ${dart} src/${dartPath}/tools/sdks/dart-sdk
${lib.optionalString (stdenv.hostPlatform.isLinux) ''
for patchtool in ''${patchtools[@]}; do
patchelf src/$patchtool --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker)
done
''}
for dir in ''${patchgit[@]}; do
pushd src/$dir
rm -rf .git
git init
git add .
git config user.name "nobody"
git config user.email "nobody@local.host"
git commit -a -m "$dir" --quiet
popd
done
dart src/${dartPath}/tools/generate_package_config.dart
echo "${dartSdkVersion}" >src/${dartPath}/sdk/version
rm -rf src/third_party/angle/.git
python3 src/flutter/tools/pub_get_offline.py
pushd src/flutter
for p in ''${patches[@]}; do
patch -p1 -i $p
done
popd
''
# error: 'close_range' is missing exception specification 'noexcept(true)'
+ lib.optionalString (lib.versionAtLeast flutterVersion "3.35") ''
substituteInPlace src/flutter/third_party/dart/runtime/bin/process_linux.cc \
--replace-fail "(unsigned int first, unsigned int last, int flags)" "(unsigned int first, unsigned int last, int flags) noexcept(true)"
''
+ ''
popd
'';
configureFlags = [
"--no-prebuilt-dart-sdk"
"--embedder-for-target"
"--no-goma"
]
++ lib.optionals (stdenv.targetPlatform.isx86_64 == false) [
"--linux"
"--linux-cpu ${constants.alt-arch}"
]
++ lib.optional (!isOptimized) "--unoptimized"
++ lib.optional (runtimeMode == "debug") "--no-stripped"
++ lib.optional finalAttrs.finalPackage.doCheck "--enable-unittests"
++ lib.optional (!finalAttrs.finalPackage.doCheck) "--no-enable-unittests";
# NOTE: Once https://github.com/flutter/flutter/issues/127606 is fixed, use "--no-prebuilt-dart-sdk"
configurePhase = ''
runHook preConfigure
export PYTHONPATH=$src/src/build
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
export PATH=${darwin.xcode}/Contents/Developer/usr/bin/:$PATH
''
+ ''
python3 ./src/flutter/tools/gn $configureFlags \
--runtime-mode $runtimeMode \
--out-dir $out \
--target-sysroot $toolchain \
--target-dir $outName \
--target-triple ${stdenv.targetPlatform.config} \
--enable-fontconfig
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
export TERM=dumb
${lib.optionalString (lib.versionAtLeast flutterVersion "3.29") ''
# ValueError: ZIP does not support timestamps before 1980
substituteInPlace src/flutter/build/zip.py \
--replace-fail "zipfile.ZipFile(args.output, 'w', zipfile.ZIP_DEFLATED)" "zipfile.ZipFile(args.output, 'w', zipfile.ZIP_DEFLATED, strict_timestamps=False)"
''}
ninja -C $out/out/$outName -j$NIX_BUILD_CORES
runHook postBuild
'';
# Tests are broken
doCheck = false;
checkPhase = ''
ln -s $out/out src/out
touch src/out/run_tests.log
sh src/flutter/testing/run_tests.sh $outName
rm src/out/run_tests.log
'';
installPhase = ''
runHook preInstall
rm -rf $out/out/$outName/{obj,exe.unstripped,lib.unstripped,zip_archives}
rm $out/out/$outName/{args.gn,build.ninja,build.ninja.d,compile_commands.json,toolchain.ninja}
find $out/out/$outName -name '*_unittests' -delete
find $out/out/$outName -name '*_benchmarks' -delete
''
+ lib.optionalString (finalAttrs.finalPackage.doCheck) ''
rm $out/out/$outName/{display_list_rendertests,flutter_tester}
''
+ ''
runHook postInstall
'';
passthru = {
dart = callPackage ./dart.nix { engine = finalAttrs.finalPackage; };
};
meta = {
# Very broken on Darwin
broken = stdenv.hostPlatform.isDarwin;
description = "Flutter engine";
homepage = "https://flutter.dev";
maintainers = with lib.maintainers; [ RossComputerGuy ];
license = lib.licenses.bsd3;
platforms = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
}
// lib.optionalAttrs (lib.versionOlder flutterVersion "3.22") { hydraPlatforms = [ ]; };
})

View File

@@ -0,0 +1,247 @@
#!/usr/bin/env python3
#
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import os
import subprocess
import sys
import re
from optparse import OptionParser
# This script runs pkg-config, optionally filtering out some results, and
# returns the result.
#
# The result will be [ <includes>, <cflags>, <libs>, <lib_dirs>, <ldflags> ]
# where each member is itself a list of strings.
#
# You can filter out matches using "-v <regexp>" where all results from
# pkgconfig matching the given regular expression will be ignored. You can
# specify more than one regular expression my specifying "-v" more than once.
#
# You can specify a sysroot using "-s <sysroot>" where sysroot is the absolute
# system path to the sysroot used for compiling. This script will attempt to
# generate correct paths for the sysroot.
#
# When using a sysroot, you must also specify the architecture via
# "-a <arch>" where arch is either "x86" or "x64".
#
# CrOS systemroots place pkgconfig files at <systemroot>/usr/share/pkgconfig
# and one of <systemroot>/usr/lib/pkgconfig or <systemroot>/usr/lib64/pkgconfig
# depending on whether the systemroot is for a 32 or 64 bit architecture. They
# specify the 'lib' or 'lib64' of the pkgconfig path by defining the
# 'system_libdir' variable in the args.gn file. pkg_config.gni communicates this
# variable to this script with the "--system_libdir <system_libdir>" flag. If no
# flag is provided, then pkgconfig files are assumed to come from
# <systemroot>/usr/lib/pkgconfig.
#
# Additionally, you can specify the option --atleast-version. This will skip
# the normal outputting of a dictionary and instead print true or false,
# depending on the return value of pkg-config for the given package.
def SetConfigPath(options):
"""Set the PKG_CONFIG_LIBDIR environment variable.
This takes into account any sysroot and architecture specification from the
options on the given command line.
"""
sysroot = options.sysroot
assert sysroot
# Compute the library path name based on the architecture.
arch = options.arch
if sysroot and not arch:
print("You must specify an architecture via -a if using a sysroot.")
sys.exit(1)
libdir = sysroot + '/' + options.system_libdir + '/pkgconfig'
libdir += ':' + sysroot + '/share/pkgconfig'
os.environ['PKG_CONFIG_LIBDIR'] = libdir
return libdir
def GetPkgConfigPrefixToStrip(options, args):
"""Returns the prefix from pkg-config where packages are installed.
This returned prefix is the one that should be stripped from the beginning of
directory names to take into account sysroots.
"""
# Some sysroots, like the Chromium OS ones, may generate paths that are not
# relative to the sysroot. For example,
# /path/to/chroot/build/x86-generic/usr/lib/pkgconfig/pkg.pc may have all
# paths relative to /path/to/chroot (i.e. prefix=/build/x86-generic/usr)
# instead of relative to /path/to/chroot/build/x86-generic (i.e prefix=/usr).
# To support this correctly, it's necessary to extract the prefix to strip
# from pkg-config's |prefix| variable.
prefix = subprocess.check_output([options.pkg_config,
"--variable=prefix"] + args, env=os.environ).decode('utf-8')
return prefix
def MatchesAnyRegexp(flag, list_of_regexps):
"""Returns true if the first argument matches any regular expression in the
given list."""
for regexp in list_of_regexps:
if regexp.search(flag) != None:
return True
return False
def RewritePath(path, strip_prefix, sysroot):
"""Rewrites a path by stripping the prefix and prepending the sysroot."""
if os.path.isabs(path) and not path.startswith(sysroot):
if path.startswith(strip_prefix):
path = path[len(strip_prefix):]
path = path.lstrip('/')
return os.path.join(sysroot, path)
else:
return path
def main():
# If this is run on non-Linux platforms, just return nothing and indicate
# success. This allows us to "kind of emulate" a Linux build from other
# platforms.
if "linux" not in sys.platform:
print("[[],[],[],[],[]]")
return 0
parser = OptionParser()
parser.add_option('-d', '--debug', action='store_true')
parser.add_option('-p', action='store', dest='pkg_config', type='string',
default='pkg-config')
parser.add_option('-v', action='append', dest='strip_out', type='string')
parser.add_option('-s', action='store', dest='sysroot', type='string')
parser.add_option('-a', action='store', dest='arch', type='string')
parser.add_option('--system_libdir', action='store', dest='system_libdir',
type='string', default='lib')
parser.add_option('--atleast-version', action='store',
dest='atleast_version', type='string')
parser.add_option('--libdir', action='store_true', dest='libdir')
parser.add_option('--dridriverdir', action='store_true', dest='dridriverdir')
parser.add_option('--version-as-components', action='store_true',
dest='version_as_components')
(options, args) = parser.parse_args()
# Make a list of regular expressions to strip out.
strip_out = []
if options.strip_out != None:
for regexp in options.strip_out:
strip_out.append(re.compile(regexp))
if options.sysroot:
libdir = SetConfigPath(options)
if options.debug:
sys.stderr.write('PKG_CONFIG_LIBDIR=%s\n' % libdir)
prefix = GetPkgConfigPrefixToStrip(options, args)
else:
prefix = ''
if options.atleast_version:
# When asking for the return value, just run pkg-config and print the return
# value, no need to do other work.
if not subprocess.call([options.pkg_config,
"--atleast-version=" + options.atleast_version] +
args):
print("true")
else:
print("false")
return 0
if options.version_as_components:
cmd = [options.pkg_config, "--modversion"] + args
try:
version_string = subprocess.check_output(cmd).decode('utf-8')
except:
sys.stderr.write('Error from pkg-config.\n')
return 1
print(json.dumps(list(map(int, version_string.strip().split(".")))))
return 0
if options.libdir:
cmd = [options.pkg_config, "--variable=libdir"] + args
if options.debug:
sys.stderr.write('Running: %s\n' % cmd)
try:
libdir = subprocess.check_output(cmd).decode('utf-8')
except:
print("Error from pkg-config.")
return 1
sys.stdout.write(libdir.strip())
return 0
if options.dridriverdir:
cmd = [options.pkg_config, "--variable=dridriverdir"] + args
if options.debug:
sys.stderr.write('Running: %s\n' % cmd)
try:
dridriverdir = subprocess.check_output(cmd).decode('utf-8')
except:
print("Error from pkg-config.")
return 1
sys.stdout.write(dridriverdir.strip())
return
cmd = [options.pkg_config, "--cflags", "--libs"] + args
if options.debug:
sys.stderr.write('Running: %s\n' % ' '.join(cmd))
try:
flag_string = subprocess.check_output(cmd).decode('utf-8')
except:
sys.stderr.write('Could not run pkg-config.\n')
return 1
# For now just split on spaces to get the args out. This will break if
# pkgconfig returns quoted things with spaces in them, but that doesn't seem
# to happen in practice.
all_flags = flag_string.strip().split(' ')
sysroot = options.sysroot
if not sysroot:
sysroot = ''
includes = []
cflags = []
libs = []
lib_dirs = []
for flag in all_flags[:]:
if len(flag) == 0 or MatchesAnyRegexp(flag, strip_out):
continue;
if flag[:2] == '-l':
libs.append(RewritePath(flag[2:], prefix, sysroot))
elif flag[:2] == '-L':
lib_dirs.append(RewritePath(flag[2:], prefix, sysroot))
elif flag[:2] == '-I':
includes.append(RewritePath(flag[2:], prefix, sysroot))
elif flag[:3] == '-Wl':
# Don't allow libraries to control ld flags. These should be specified
# only in build files.
pass
elif flag == '-pthread':
# Many libs specify "-pthread" which we don't need since we always include
# this anyway. Removing it here prevents a bunch of duplicate inclusions
# on the command line.
pass
else:
cflags.append(flag)
# Output a GN array, the first one is the cflags, the second are the libs. The
# JSON formatter prints GN compatible lists when everything is a list of
# strings.
print(json.dumps([includes, cflags, libs, lib_dirs]))
return 0
if __name__ == '__main__':
sys.exit(main())

View File

@@ -0,0 +1,129 @@
{
lib,
callPackage,
fetchgit,
tools ? null,
curl,
pkg-config,
git,
python3,
runCommand,
writeText,
cacert,
flutterVersion,
version,
hashes,
url,
hostPlatform,
targetPlatform,
buildPlatform,
}@pkgs:
let
target-constants = callPackage ./constants.nix { platform = targetPlatform; };
build-constants = callPackage ./constants.nix { platform = buildPlatform; };
tools = pkgs.tools or (callPackage ./tools.nix { inherit hostPlatform buildPlatform; });
boolOption = value: if value then "True" else "False";
in
runCommand "flutter-engine-source-${version}-${buildPlatform.system}-${targetPlatform.system}"
{
pname = "flutter-engine-source";
inherit version;
inherit (tools) depot_tools;
nativeBuildInputs = [
curl
pkg-config
git
tools.cipd
(python3.withPackages (
ps: with ps; [
httplib2
six
]
))
];
gclient = writeText "flutter-engine-${version}.gclient" ''
solutions = [{
"managed": False,
"name": "${lib.optionalString (lib.versionAtLeast flutterVersion "3.29") "engine/"}src/flutter",
"url": "${url}",
"custom_vars": {
"download_fuchsia_deps": False,
"download_android_deps": False,
"download_linux_deps": ${boolOption targetPlatform.isLinux},
"setup_githooks": False,
"download_esbuild": False,
"download_dart_sdk": False,
"host_cpu": "${build-constants.alt-arch}",
"host_os": "${build-constants.alt-os}",
},
}]
target_os_only = True
target_os = [
"${target-constants.alt-os}"
]
target_cpu_only = True
target_cpu = [
"${target-constants.alt-arch}"
]
'';
NIX_SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
DEPOT_TOOLS_UPDATE = "0";
DEPOT_TOOLS_COLLECT_METRICS = "0";
PYTHONDONTWRITEBYTECODE = "1";
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash =
(hashes."${buildPlatform.system}" or { })."${targetPlatform.system}"
or (throw "Hash not set for ${targetPlatform.system} on ${buildPlatform.system}");
}
(
''
source ${../../../../build-support/fetchgit/deterministic-git}
export -f clean_git
export -f make_deterministic_repo
''
+ (
if lib.versionAtLeast flutterVersion "3.29" then
''
mkdir -p source
cp $gclient source/.gclient
cd source
''
else
''
mkdir -p $out
cp $gclient $out/.gclient
cd $out
''
)
+ ''
export PATH=$PATH:$depot_tools
python3 $depot_tools/gclient.py sync --no-history --shallow --nohooks -j $NIX_BUILD_CORES
''
+ lib.optionalString (lib.versionAtLeast flutterVersion "3.29") ''
cp -r engine/src/flutter/third_party/* engine/src/flutter/engine/src/flutter/third_party/
mv engine/src/flutter/engine $out
''
+ ''
find $out -name '.git' -exec rm -rf {} \; || true
rm -rf $out/src/{buildtools,fuchsia}
rm -rf $out/src/flutter/{buildtools,prebuilts,third_party/swiftshader,third_party/gn/.versions}
rm -rf $out/src/flutter/{third_party/dart/tools/sdks/dart-sdk,third_party/ninja/ninja,third_party/java}
rm -rf $out/src/third_party/{dart/tools/sdks/dart-sdk,libcxx/test}
rm -rf $out/.cipd $out/.gclient $out/.gclient_entries $out/.gclient_previous_custom_vars $out/.gclient_previous_sync_commits
''
)

View File

@@ -0,0 +1,97 @@
{
stdenv,
buildPlatform,
hostPlatform,
callPackage,
fetchgit,
fetchurl,
writeText,
runCommand,
darwin,
writeShellScriptBin,
depot_toolsCommit ? "7d95eb2eb054447592585c73a8ff7adad97ecba1",
depot_toolsHash ? "sha256-F7KDuVg11qLKkohIjuXpNdxpnSsT6Z3hE9+wFIG2sSk=",
cipdCommit ? "89ada246fcbf10f330011e4991d017332af2365b",
cipdHashes ? {
"linux-386" = "7f264198598af2ef9d8878349d33c1940f1f3739e46d986962c352ec4cce2690";
"linux-amd64" = "2ada6b46ad1cd1350522c5c05899d273f5c894c7665e30104e7f57084a5aeeb9";
"linux-arm64" = "96eca7e49f6732c50122b94b793c3a5e62ed77bce1686787a8334906791b4168";
"linux-armv6l" = "06394601130652c5e1b055a7e4605c21fc7c6643af0b3b3cac8d2691491afa81";
"linux-mips64" = "f3eda6542b381b7aa8f582698498b0e197972c894590ec35f18faa467c868f5c";
"linux-mips64le" = "74229ada8e2afd9c8e7c58991126869b2880547780d4a197a27c1dfa96851622";
"linux-mipsle" = "2f3c18ec0ad48cd44a9ff39bb60e9afded83ca43fb9c7a5ea9949f6fdd4e1394";
"linux-ppc64" = "79425c0795fb8ba12b39a8856bf7ccb853e85def4317aa6413222f307d4c2dbd";
"linux-ppc64le" = "f9b3d85dde70f1b78cd7a41d2477834c15ac713a59317490a4cdac9f8f092325";
"linux-riscv64" = "bd695164563a66e8d3799e8835f90a398fbae9a4eec24e876c92d5f213943482";
"linux-s390x" = "6f501af80541e733fda23b4208a21ea05919c95d236036a2121e6b6334a2792c";
"macos-amd64" = "41d05580c0014912d6c32619c720646fd136e4557c9c7d7571ecc8c0462733a1";
"macos-arm64" = "dc672bd16d9faf277dd562f1dc00644b10c03c5d838d3cc3d3ea29925d76d931";
"windows-386" = "fa6ed0022a38ffc51ff8a927e3947fe7e59a64b2019dcddca9d3afacf7630444";
"windows-amd64" = "b5423e4b4429837f7fe4d571ce99c068aa0ccb37ddbebc1978a423fd2b0086df";
},
}:
let
constants = callPackage ./constants.nix { platform = buildPlatform; };
host-constants = callPackage ./constants.nix { platform = hostPlatform; };
stdenv-constants = callPackage ./constants.nix { platform = stdenv.hostPlatform; };
in
{
depot_tools = fetchgit {
url = "https://chromium.googlesource.com/chromium/tools/depot_tools.git";
rev = depot_toolsCommit;
hash = depot_toolsHash;
};
cipd =
let
unwrapped =
runCommand "cipd-${cipdCommit}"
{
src = fetchurl {
name = "cipd-${cipdCommit}-unwrapped";
url = "https://chrome-infra-packages.appspot.com/client?platform=${stdenv-constants.platform}&version=git_revision:${cipdCommit}";
sha256 = cipdHashes.${stdenv-constants.platform};
};
}
''
mkdir -p $out/bin
install -m755 $src $out/bin/cipd
'';
in
writeShellScriptBin "cipd" ''
params=$@
if [[ "$1" == "ensure" ]]; then
shift 1
params="ensure"
while [ "$#" -ne 0 ]; do
if [[ "$1" == "-ensure-file" ]]; then
ensureFile="$2"
shift 2
params="$params -ensure-file $ensureFile"
sed -i 's/''${platform}/${host-constants.platform}/g' "$ensureFile"
sed -i 's/gn\/gn\/${stdenv-constants.platform}/gn\/gn\/${constants.platform}/g' "$ensureFile"
if grep flutter/java/openjdk "$ensureFile" >/dev/null; then
sed -i '/src\/flutter\/third_party\/java\/openjdk/,+2 d' "$ensureFile"
fi
else
params="$params $1"
shift 1
fi
done
fi
exec ${unwrapped}/bin/cipd $params
'';
vpython =
pythonPkg:
runCommand "vpython3" { } "mkdir -p $out/bin && ln -s ${pythonPkg}/bin/python $out/bin/vpython3";
xcode-select = writeShellScriptBin "xcode-select" ''
echo ${darwin.xcode}/Contents/Developer
'';
}