flutter: Separate cache and unwrapped derivations #2 #240715
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
And this:
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.sh
runs 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 = true
set 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/
)