@@ -1,9 +1,10 @@
|
||||
{ pname
|
||||
, version
|
||||
, sha256Hash
|
||||
, patches
|
||||
, dart
|
||||
, src
|
||||
, depsSha256
|
||||
, channel ? "stable"
|
||||
, filename ? "flutter_linux_${version}-${channel}.tar.xz"
|
||||
}:
|
||||
|
||||
{ bash
|
||||
@@ -30,20 +31,21 @@
|
||||
, nspr
|
||||
, nss
|
||||
, systemd
|
||||
, callPackage
|
||||
}:
|
||||
let
|
||||
repository = callPackage ./repository.nix {
|
||||
inherit src pname version dart depsSha256;
|
||||
};
|
||||
drvName = "flutter-${version}";
|
||||
|
||||
drvName = "flutter-${channel}-${version}";
|
||||
flutter = stdenv.mkDerivation {
|
||||
name = "${drvName}-unwrapped";
|
||||
|
||||
buildInputs = [ git repository ];
|
||||
src = fetchurl {
|
||||
url =
|
||||
"https://storage.googleapis.com/flutter_infra/releases/${channel}/linux/${filename}";
|
||||
sha256 = sha256Hash;
|
||||
};
|
||||
|
||||
inherit src patches;
|
||||
buildInputs = [ git ];
|
||||
|
||||
inherit patches;
|
||||
|
||||
postPatch = ''
|
||||
patchShebangs --build ./bin/
|
||||
@@ -51,25 +53,25 @@ let
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
export FLUTTER_ROOT="$(pwd)"
|
||||
export FLUTTER_TOOLS_DIR="$FLUTTER_ROOT/packages/flutter_tools"
|
||||
export SCRIPT_PATH="$FLUTTER_TOOLS_DIR/bin/flutter_tools.dart"
|
||||
FLUTTER_ROOT=$(pwd)
|
||||
FLUTTER_TOOLS_DIR="$FLUTTER_ROOT/packages/flutter_tools"
|
||||
SNAPSHOT_PATH="$FLUTTER_ROOT/bin/cache/flutter_tools.snapshot"
|
||||
STAMP_PATH="$FLUTTER_ROOT/bin/cache/flutter_tools.stamp"
|
||||
SCRIPT_PATH="$FLUTTER_TOOLS_DIR/bin/flutter_tools.dart"
|
||||
DART_SDK_PATH="${dart}"
|
||||
|
||||
mkdir -p "$out/bin/cache"
|
||||
export SNAPSHOT_PATH="$out/bin/cache/flutter_tools.snapshot"
|
||||
export STAMP_PATH="$out/bin/cache/flutter_tools.stamp"
|
||||
HOME=../.. # required for pub upgrade --offline, ~/.pub-cache
|
||||
# path is relative otherwise it's replaced by /build/flutter
|
||||
|
||||
export DART_SDK_PATH="${dart}"
|
||||
export PUB_CACHE="${repository}"
|
||||
|
||||
pushd "$FLUTTER_TOOLS_DIR"
|
||||
${dart}/bin/pub get --offline
|
||||
popd
|
||||
(cd "$FLUTTER_TOOLS_DIR" && ${dart}/bin/pub upgrade --offline)
|
||||
|
||||
local revision="$(cd "$FLUTTER_ROOT"; git rev-parse HEAD)"
|
||||
${dart}/bin/dart --snapshot="$SNAPSHOT_PATH" --packages="$FLUTTER_TOOLS_DIR/.packages" "$SCRIPT_PATH"
|
||||
echo "$revision" > "$STAMP_PATH"
|
||||
echo -n "${version}" > version
|
||||
|
||||
rm -rf bin/cache/{artifacts,dart-sdk,downloads}
|
||||
rm -f bin/cache/*.stamp
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
|
||||
Reference in New Issue
Block a user