Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fvm in devenv again. #1726

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading