summaryrefslogtreecommitdiffstats
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorThiago Kenji Okada <thiagokokada@gmail.com>2021-01-24 09:10:52 -0300
committerThiago Kenji Okada <thiagokokada@gmail.com>2021-01-27 14:48:10 -0300
commit5f72a823deeab9ef9f94bd7b208d11fab281f5d6 (patch)
treed010544e073c19bb6e4c69a3d7d0138e71d94935 /pkgs/development/compilers
parente19491e24c98c9da4900b7c890ded47f7bfb58ee (diff)
flutter: 1.22.4 -> 1.22.5
Needs to do a build in 2-pass now since Google stopped shipping all dependencies needed to build Flutter. This may be an oversight from them since they used to ship everything, but this makes the whole build process more robust. The first step will download all dependencies from pub, and the second step will build Flutter. Since we need to build repository first, we also require a new depsSha256 parameter to be passed, that represents the SHA256 of the resulting derivation of all Flutter dependencies downloaded from https://pub.dev. This commit also makes some changes in mkFlutter, allowing the user to pass src instead of passing version/channel/filename, allowing for more flexibility (i.e: building from a local fork of Flutter).
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/flutter/default.nix17
-rw-r--r--pkgs/development/compilers/flutter/flutter.nix46
-rw-r--r--pkgs/development/compilers/flutter/patches/disable-auto-update.patch (renamed from pkgs/development/compilers/flutter/patches/stable/disable-auto-update.patch)0
-rw-r--r--pkgs/development/compilers/flutter/patches/move-cache.patch (renamed from pkgs/development/compilers/flutter/patches/stable/move-cache.patch)0
-rw-r--r--pkgs/development/compilers/flutter/repository.nix24
5 files changed, 58 insertions, 29 deletions
diff --git a/pkgs/development/compilers/flutter/default.nix b/pkgs/development/compilers/flutter/default.nix
index 61641e95960e..8572040cb0cd 100644
--- a/pkgs/development/compilers/flutter/default.nix
+++ b/pkgs/development/compilers/flutter/default.nix
@@ -1,17 +1,24 @@
-{ callPackage, dart }:
+{ callPackage, fetchurl, dart }:
+
let
mkFlutter = opts: callPackage (import ./flutter.nix opts) { };
getPatches = dir:
let files = builtins.attrNames (builtins.readDir dir);
in map (f: dir + ("/" + f)) files;
+ version = "1.22.5";
+ channel = "stable";
+ filename = "flutter_linux_${version}-${channel}.tar.xz";
in
{
mkFlutter = mkFlutter;
stable = mkFlutter rec {
- inherit dart;
+ inherit dart version;
pname = "flutter";
- version = "1.22.4";
- sha256Hash = "0qalgav9drqddcj8lfvl9ddf3325n953pvkmgha47lslg9sa88zw";
- patches = getPatches ./patches/stable;
+ patches = getPatches ./patches;
+ src = fetchurl {
+ url = "https://storage.googleapis.com/flutter_infra/releases/${channel}/linux/${filename}";
+ sha256 = "1dv5kczcj9npf7xxlanmpc9ijnxa3ap46521cxn14c0i3y9295ja";
+ };
+ depsSha256 = "0d7vhk6axgqajy2d9ia9lc6awcnz6cc3n04r7hnh7bx4hb0jv0l1";
};
}
diff --git a/pkgs/development/compilers/flutter/flutter.nix b/pkgs/development/compilers/flutter/flutter.nix
index bb955ba2b80d..230add2a320f 100644
--- a/pkgs/development/compilers/flutter/flutter.nix
+++ b/pkgs/development/compilers/flutter/flutter.nix
@@ -1,10 +1,9 @@
{ pname
, version
-, sha256Hash
, patches
, dart
-, channel ? "stable"
-, filename ? "flutter_linux_${version}-${channel}.tar.xz"
+, src
+, depsSha256
}:
{ bash
@@ -31,21 +30,20 @@
, nspr
, nss
, systemd
+, callPackage
}:
let
- drvName = "flutter-${channel}-${version}";
+ repository = callPackage ./repository.nix {
+ inherit src pname version dart depsSha256;
+ };
+ drvName = "flutter-${version}";
+
flutter = stdenv.mkDerivation {
name = "${drvName}-unwrapped";
- src = fetchurl {
- url =
- "https://storage.googleapis.com/flutter_infra/releases/${channel}/linux/${filename}";
- sha256 = sha256Hash;
- };
-
- buildInputs = [ git ];
+ buildInputs = [ git repository ];
- inherit patches;
+ inherit src patches;
postPatch = ''
patchShebangs --build ./bin/
@@ -53,25 +51,25 @@ let
'';
buildPhase = ''
- 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}"
+ export FLUTTER_ROOT="$(pwd)"
+ export FLUTTER_TOOLS_DIR="$FLUTTER_ROOT/packages/flutter_tools"
+ export SCRIPT_PATH="$FLUTTER_TOOLS_DIR/bin/flutter_tools.dart"
- HOME=../.. # required for pub upgrade --offline, ~/.pub-cache
- # path is relative otherwise it's replaced by /build/flutter
+ mkdir -p "$out/bin/cache"
+ export SNAPSHOT_PATH="$out/bin/cache/flutter_tools.snapshot"
+ export STAMP_PATH="$out/bin/cache/flutter_tools.stamp"
- (cd "$FLUTTER_TOOLS_DIR" && ${dart}/bin/pub upgrade --offline)
+ export DART_SDK_PATH="${dart}"
+ export PUB_CACHE="${repository}"
+
+ pushd "$FLUTTER_TOOLS_DIR"
+ ${dart}/bin/pub get --offline
+ popd
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 = ''
diff --git a/pkgs/development/compilers/flutter/patches/stable/disable-auto-update.patch b/pkgs/development/compilers/flutter/patches/disable-auto-update.patch
index 35ce5b367350..35ce5b367350 100644
--- a/pkgs/development/compilers/flutter/patches/stable/disable-auto-update.patch
+++ b/pkgs/development/compilers/flutter/patches/disable-auto-update.patch
diff --git a/pkgs/development/compilers/flutter/patches/stable/move-cache.patch b/pkgs/development/compilers/flutter/patches/move-cache.patch
index dc77496edb31..dc77496edb31 100644
--- a/pkgs/development/compilers/flutter/patches/stable/move-cache.patch
+++ b/pkgs/development/compilers/flutter/patches/move-cache.patch
diff --git a/pkgs/development/compilers/flutter/repository.nix b/pkgs/development/compilers/flutter/repository.nix
new file mode 100644
index 000000000000..0f8de0a912f1
--- /dev/null
+++ b/pkgs/development/compilers/flutter/repository.nix
@@ -0,0 +1,24 @@
+{ lib, stdenv, dart, fetchurl, src, pname, version, depsSha256 }:
+
+stdenv.mkDerivation {
+ inherit src version;
+
+ pname = "${pname}-deps";
+ buildInputs = [ dart ];
+
+ buildPhase = ''
+ export PUB_CACHE="$out"
+ export FLUTTER_ROOT="$(pwd)"
+ export FLUTTER_TOOLS_DIR="$FLUTTER_ROOT/packages/flutter_tools"
+
+ pushd "$FLUTTER_TOOLS_DIR"
+ ${dart}/bin/pub get
+ '';
+
+ dontInstall = true;
+ dontFixup = true;
+
+ outputHashAlgo = "sha256";
+ outputHashMode = "recursive";
+ outputHash = depsSha256;
+}