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.
This brings the following benefits:
- Artifacts missing in the SDK tarball (such as prebuilts for linux-aarch64) can be obtained
- Artifacts can be patched more granularly (e.g. libflutter_linux_gtk is patchelf-ed for GTK3, and the linux-aarch64 assets have a postPatch to add some missing files)
- Minimal Flutter packages can be generated (e.g. mkFlutterApp only needs prebuilts for desktop Linux, and developers that don't care for desktop Linux can exclude the artifacts and dependencies)
It also paves the way for including manually built engine facts.
This allows SDK artifacts (including build tools and libraries) to use the right interpreter and library locations, abolishing the need for a FHS or post-build patches.
`autoPatchelf` has been used through `autoPatchelfHook`, instead of the `autoPatchelf` command on just the artifact directory, due to the latter method not patching interpreter paths (https://discourse.nixos.org/t/trying-to-use-autopatchelf/24003).
Co-authored-by: FlafyDev <flafyarazi@gmail.com>
Co-authored-by: gilice <gilice@proton.me>
Co-authored-by: hacker1024 <hacker1024@users.sourceforge.net>
The following principles are now in place:
- All wrappers will include SDK file symlinks. There is not much of a reason to not do so, and removing the option to omit it makes it easier to understand what each wrapper does.
- There is no longer a way to get the previous derivation from a wrapper. This could yield unexpected results based on the wrapping order. Instead, "sdk", "unwrapped", and "noFHS" passthru attributes are provided where appropriate.
checkInputs used to be added to nativeBuildInputs. Now we have
nativeCheckInputs to do that instead. Doing this treewide change allows
to keep hashes identical to before the introduction of
nativeCheckInputs.
Needs to do a build in 2-pass now since Google stopped shipping all
dependencies needed to build Flutter. This may be an oversight from them
since they used to ship everything, but this makes the whole build
process more robust.
The first step will download all dependencies from pub, and the
second step will build Flutter. Since we need to build repository
first, we also require a new depsSha256 parameter to be passed, that
represents the SHA256 of the resulting derivation of all Flutter
dependencies downloaded from https://pub.dev.
This commit also makes some changes in mkFlutter, allowing the
user to pass src instead of passing version/channel/filename, allowing
for more flexibility (i.e: building from a local fork of Flutter).
Related issue #108606.
Nowadays we have multiple outdated versions of Flutter in nixpkgs.
Instead, let's focus in having in having stable versions of Flutter
working.
Users needing to use beta or dev versions of Flutter can use mkFlutter
function, that still exists.
Instead of copying the whole dart derivation to bin/cache/dart-sdk
directory, just symlink it.
Also, make sure that the flutter is build from dart passed as a
parameter.
Before:
/nix/store/p3avfmvd0yrjpwwml7vvqbjin5vacx2k-flutter-stable-1.22.0 2084894968
After:
/nix/store/750k4z1yj5xsw7ymmwvn7cfjjzkaygzg-flutter-stable-1.22.0 1647047080
flutter: add beta and dev channels
flutter: artifacts are now downloaded in $HOME/.cache/flutter
flutter: remove all artifacts from flutter
flutter: fix lockfile path
flutter: fix pub_cache
flutter: fix flutter_tools/.packages pointing to /build
flutter: clean patches
flutter: fix write error on .cache/flutter/lockfile
flutter: add zlib as a dependency
flutter: add missing dependencies
flutter: fix flutter version
flutter: update versions + dependencies