Skip to content

Commit

Permalink
Use fvm in devenv again. (#1726)
Browse files Browse the repository at this point in the history
Needed for #1703 (or upgrading flutter in general right now), because
using the current nix version of flutter 3.24 lead me to this bug:
flutter/flutter#153238 and I don't want to
block upgrading flutter further, since until the nix version of flutter
is upgraded it will probably take a week or more.
  • Loading branch information
Jonas-Sander authored Sep 5, 2024
1 parent a5a9c1c commit 4f76401
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@
{ pkgs, inputs, lib, ... }:

let
pkgs-unstable = import inputs.nixpkgs-unstable { system = pkgs.stdenv.system; };
flutter = pkgs-unstable.flutter.overrideAttrs
{
src = pkgs-unstable.fetchFromGitHub
{
owner = "flutter";
repo = "flutter";
rev = "3.22.2";
sha256 = "7ndnIw72YxNB+VeeejEeRD+xxuLXOcWo322s5CMWzBM=";
};
};
androidenv = android-pkgs.androidenv.override {
# Seems to only work when androidenv.buildApp is used
# afterwards (we don't).
Expand Down Expand Up @@ -56,7 +45,6 @@ in
env = {
ANDROID_HOME = "${android-sdk-root}";
ANDROID_SDK_ROOT = "${android-sdk-root}";
FLUTTER_ROOT = "${flutter}";
CHROME_EXECUTABLE = "${pkgs.google-chrome}/bin/google-chrome-stable";
};

Expand All @@ -66,7 +54,9 @@ in
pkgs.nixpkgs-fmt

android-sdk
flutter

# Running `fvm flutter` -> 'Missing "unzip" tool. Unable to extract Dart SDK.'
pkgs.unzip

# For Flutter Web development
pkgs.google-chrome
Expand All @@ -80,11 +70,23 @@ in
enterShell = ''
# Make pub cache work so that we can execute
# e.g. `dart pub global activate fvm`
#export PATH="$PATH":"$HOME/.pub-cache/bin"
export PATH="$PATH":"$HOME/.pub-cache/bin"
# Make sz cli work
export PATH="$PATH":"$DEVENV_ROOT/bin"
if ! command -v fvm &> /dev/null
then
echo "fvm could not be found. Installing FVM via dart pub global."
dart pub global activate fvm
# fvm install will fail getting dependencies if we dont
# cd to app. Using && will only change it for the fvm
# install command
cd app && fvm install
fi
fvm flutter config --android-sdk ${android-sdk-root}
# When running e.g. `sz pub get -c 0` the analytics
# will cause the task to fail (maybe because so many signals
# are sent in a short time). So we just disable analytics
Expand All @@ -96,7 +98,7 @@ in
# start running e.g. `sz pub get` right away. Without this
# one would first have to run pub get in the sz cli folder
# manually.
dart pub get --directory ./tools/sz_repo_cli
fvm dart pub get --directory ./tools/sz_repo_cli
'';

languages = {
Expand All @@ -105,6 +107,9 @@ in
enable = true;
jdk.package = pkgs.jdk17;
};

# Use this so that we can run "dart pub global activate fvm"
dart.enable = true;
};

# See full reference at https://devenv.sh/reference/options/
Expand Down

0 comments on commit 4f76401

Please sign in to comment.