flutter: Separate cache and unwrapped derivations #2#240715
flutter: Separate cache and unwrapped derivations #2#240715Kranzes merged 1 commit intoNixOS:masterfrom
Conversation
flutter-unwrapped will now not come with engine artifacts in its cache directory(`$out/bin/cache`). To specify a different cache directory, set FLUTTER_CACHE_DIR. Flutter's wrapper now sets FLUTTER_CACHE_DIR to set engine artifacts. The sh file `$out/bin/internal/shared.sh` runs when launching Flutter and calls `"$FLUTTER_ROOT/bin/cache/` instead of our environment variable `FLUTTER_CACHE_DIR`. I decided not to patch it since the script doesn't require engine artifacts(which are the only thing not added by the unwrapped derivation), so it shouldn't fail, and patching it will just be harder to maintain.
d81c367 to
570f3ef
Compare
|
CC @hacker1024 @gilice @SuperSandro2000
Done
Done. I reduced most of the let ins.
I'm not sure where to move the default value to.
you would usually edit |
|
Result of 16 packages built:
|
This PR is a continuation of 238177 (Sorry for the trouble)
flutter-unwrapped will now not come with engine artifacts in its cache directory.
To specify a different cache directory, set FLUTTER_CACHE_DIR
Before this PR, changing which artifacts Flutter will have required rebuilding Flutter. This is because Flutter's unwrapped derivation required symlinking the engine artifacts to the cache directory(
$out/bin/cache).So this:
pkgs.flutter.override { supportsAndroid = false; supportsLinuxDesktop = true; }And this:
pkgs.flutter.override { supportsAndroid = true; supportsLinuxDesktop = true; }Would build Flutter twice, even though it's not necessary.
To fix this, this PR moved the cache directory to an environment variable(when specified). This allows changing which artifacts
Flutter sees at runtime, so no need to rebuild.
Additionally, the wrapper has been adjusted to this change and will now provide the engine artifacts through
FLUTTER_CACHE_DIR.Note
The sh file
$out/bin/internal/shared.shruns when launching Flutter and calls$FLUTTER_ROOT/bin/cache/instead of our environment variableFLUTTER_CACHE_DIR.I decided not to patch it since the script doesn't require engine artifacts(which are the only thing not added by the unwrapped derivation), so it shouldn't fail, and patching it will just be harder to maintain.
Description of changes
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)