From f5294b802d742568f16cc9aa0d7ebc4030898d30 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Fri, 29 Jan 2021 14:50:13 -0300 Subject: [PATCH 1/2] Revert "flutter: 1.22.4 -> 1.22.5" This reverts commit 5f72a823deeab9ef9f94bd7b208d11fab281f5d6. --- .../development/compilers/flutter/default.nix | 17 ++----- .../development/compilers/flutter/flutter.nix | 46 ++++++++++--------- .../{ => stable}/disable-auto-update.patch | 0 .../patches/{ => stable}/move-cache.patch | 0 .../compilers/flutter/repository.nix | 24 ---------- 5 files changed, 29 insertions(+), 58 deletions(-) rename pkgs/development/compilers/flutter/patches/{ => stable}/disable-auto-update.patch (100%) rename pkgs/development/compilers/flutter/patches/{ => stable}/move-cache.patch (100%) delete mode 100644 pkgs/development/compilers/flutter/repository.nix diff --git a/pkgs/development/compilers/flutter/default.nix b/pkgs/development/compilers/flutter/default.nix index 8572040cb0c..61641e95960 100644 --- a/pkgs/development/compilers/flutter/default.nix +++ b/pkgs/development/compilers/flutter/default.nix @@ -1,24 +1,17 @@ -{ callPackage, fetchurl, dart }: - +{ callPackage, 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 version; + inherit dart; pname = "flutter"; - patches = getPatches ./patches; - src = fetchurl { - url = "https://storage.googleapis.com/flutter_infra/releases/${channel}/linux/${filename}"; - sha256 = "1dv5kczcj9npf7xxlanmpc9ijnxa3ap46521cxn14c0i3y9295ja"; - }; - depsSha256 = "0d7vhk6axgqajy2d9ia9lc6awcnz6cc3n04r7hnh7bx4hb0jv0l1"; + version = "1.22.4"; + sha256Hash = "0qalgav9drqddcj8lfvl9ddf3325n953pvkmgha47lslg9sa88zw"; + patches = getPatches ./patches/stable; }; } diff --git a/pkgs/development/compilers/flutter/flutter.nix b/pkgs/development/compilers/flutter/flutter.nix index e3fcf77e391..85438af150f 100644 --- a/pkgs/development/compilers/flutter/flutter.nix +++ b/pkgs/development/compilers/flutter/flutter.nix @@ -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 = '' diff --git a/pkgs/development/compilers/flutter/patches/disable-auto-update.patch b/pkgs/development/compilers/flutter/patches/stable/disable-auto-update.patch similarity index 100% rename from pkgs/development/compilers/flutter/patches/disable-auto-update.patch rename to pkgs/development/compilers/flutter/patches/stable/disable-auto-update.patch diff --git a/pkgs/development/compilers/flutter/patches/move-cache.patch b/pkgs/development/compilers/flutter/patches/stable/move-cache.patch similarity index 100% rename from pkgs/development/compilers/flutter/patches/move-cache.patch rename to pkgs/development/compilers/flutter/patches/stable/move-cache.patch diff --git a/pkgs/development/compilers/flutter/repository.nix b/pkgs/development/compilers/flutter/repository.nix deleted file mode 100644 index 0f8de0a912f..00000000000 --- a/pkgs/development/compilers/flutter/repository.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ 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; -} From 910d06bb9038c11b26bc7439c26afe6ef77fc1a3 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Fri, 29 Jan 2021 15:03:58 -0300 Subject: [PATCH 2/2] flutter: small refactorings in derivation --- .../development/compilers/flutter/default.nix | 15 +++++--- .../development/compilers/flutter/flutter.nix | 36 +++++++++---------- .../{stable => }/disable-auto-update.patch | 0 .../patches/{stable => }/move-cache.patch | 0 4 files changed, 26 insertions(+), 25 deletions(-) rename pkgs/development/compilers/flutter/patches/{stable => }/disable-auto-update.patch (100%) rename pkgs/development/compilers/flutter/patches/{stable => }/move-cache.patch (100%) diff --git a/pkgs/development/compilers/flutter/default.nix b/pkgs/development/compilers/flutter/default.nix index 61641e95960..14f4d93caa0 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 85438af150f..8cac4a18fbe 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 similarity index 100% rename from pkgs/development/compilers/flutter/patches/stable/disable-auto-update.patch rename to 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 similarity index 100% rename from pkgs/development/compilers/flutter/patches/stable/move-cache.patch rename to pkgs/development/compilers/flutter/patches/move-cache.patch