diff --git a/devenv.nix b/devenv.nix index 7b5f33be5..bc63e4849 100644 --- a/devenv.nix +++ b/devenv.nix @@ -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). @@ -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"; }; @@ -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 @@ -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 @@ -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 = { @@ -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/