diff options
author | Thiago Kenji Okada <thiagokokada@gmail.com> | 2021-01-29 15:03:58 -0300 |
---|---|---|
committer | Thiago Kenji Okada <thiagokokada@gmail.com> | 2021-01-29 18:05:13 -0300 |
commit | 910d06bb9038c11b26bc7439c26afe6ef77fc1a3 (patch) | |
tree | a9f971ec609e3f00b3aaed9b3b3ec0cb4ef72af1 /pkgs/development | |
parent | f5294b802d742568f16cc9aa0d7ebc4030898d30 (diff) |
flutter: small refactorings in derivation
Diffstat (limited to 'pkgs/development')
-rw-r--r-- | pkgs/development/compilers/flutter/default.nix | 15 | ||||
-rw-r--r-- | pkgs/development/compilers/flutter/flutter.nix | 36 | ||||
-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 |
4 files changed, 26 insertions, 25 deletions
diff --git a/pkgs/development/compilers/flutter/default.nix b/pkgs/development/compilers/flutter/default.nix index 61641e95960e..14f4d93caa03 100644 --- a/pkgs/development/compilers/flutter/default.nix +++ b/pkgs/development/compilers/flutter/default.nix @@ -1,17 +1,22 @@ -{ 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.4"; + 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; + src = fetchurl { + url = "https://storage.googleapis.com/flutter_infra/releases/${channel}/linux/${filename}"; + sha256 = "0qalgav9drqddcj8lfvl9ddf3325n953pvkmgha47lslg9sa88zw"; + }; + patches = getPatches ./patches; }; } diff --git a/pkgs/development/compilers/flutter/flutter.nix b/pkgs/development/compilers/flutter/flutter.nix index 85438af150fd..8cac4a18fbea 100644 --- a/pkgs/development/compilers/flutter/flutter.nix +++ b/pkgs/development/compilers/flutter/flutter.nix @@ -1,10 +1,8 @@ { pname , version -, sha256Hash , patches , dart -, channel ? "stable" -, filename ? "flutter_linux_${version}-${channel}.tar.xz" +, src }: { bash @@ -33,19 +31,13 @@ , systemd }: let - drvName = "flutter-${channel}-${version}"; + 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 ]; - inherit patches; + inherit src patches; postPatch = '' patchShebangs --build ./bin/ @@ -53,25 +45,29 @@ 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" + + export SNAPSHOT_PATH="$FLUTTER_ROOT/bin/cache/flutter_tools.snapshot" + export STAMP_PATH="$FLUTTER_ROOT/bin/cache/flutter_tools.stamp" + + export DART_SDK_PATH="${dart}" HOME=../.. # required for pub upgrade --offline, ~/.pub-cache # path is relative otherwise it's replaced by /build/flutter - (cd "$FLUTTER_TOOLS_DIR" && ${dart}/bin/pub upgrade --offline) + 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 + rm -r bin/cache/{artifacts,dart-sdk,downloads} + rm 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 |