Commit Graph

20 Commits

Author SHA1 Message Date
hacker1024
915a6779fc flutter.buildFlutterApplication: Refactor dependency setup as a standalone derivation with an output hook
This allows anything that needs to build a Dart application (such as a future `buildDartApplication` function) to use the same setup.
2023-04-16 00:17:41 +10:00
hacker1024
f00f918e27 flutter: Remove cached Git package Git directories
Pub does not perform any Git operations on the cached package directly, instead cloning it through a mirror.

The .git directories are not needed, and are a source of non-determinism.
2023-04-15 20:30:46 +10:00
hacker1024
c3a87421ae flutter: Don't tarball the package cache
Co-authored-by: FlafyDev <flafyarazi@gmail.com>

The dependency fixed-output derivation now uses the recursive hash mode to avoid tarballing and copying all the files.

https://github.com/NixOS/nix/issues/6660 was ran into during the development of this change. Input references were found in the Git package cache before nukeReferences was used.

It turns out that the mirrors in the Git package cache do not actually need to be preserved, as the SDK does not use them during the build process. They are therefore deleted in the dependency derivation and re-created as blank repositories in the main derivation.

A description of the Git package cache layout can be found here: c890afa1d6/lib/src/source/git.dart (L339)
2023-04-15 20:17:44 +10:00
hacker1024
fdce3f30c4 flutter.mkFlutterApp: Don't hash more unstable files
Files and directories such as .dart_tool, .flutter-plugins, .packages and .pub-cache/hosted/*/.cache will be happily regenerated by the SDK in an offline environment.

The patches being made to these files and directories to remove non-determinism were flawed: They did not handle cases where files only appeared in one run, or cases where tooling versions had an effect on the output.
2023-04-15 03:18:56 +10:00
hacker1024
7e12e3afaa flutter.mkFlutterApp: Remove the target architecture from the dependency derivation name
As the dependency tarballs no longer include SDK artifacts, they are not platform dependent.
2023-04-14 14:25:33 +10:00
hacker1024
30caca0839 flutter.mkFlutterApp: Add Git to nativeBuildInputs
The deterministic Git script depends on it.
2023-04-14 02:16:04 +10:00
hacker1024
f7e3c19cc8 flutter.mkFlutterApp: Don't vendor arbitrary configuration files 2023-04-14 01:49:09 +10:00
hacker1024
8f9aa6b18b flutter.mkFlutterApp: Don't use autoPatchelf on package cache
While this may be beneficial for packages that ship native binaries, this causes issues due to Flutter packages that have inappropriately uploaded build artifacts (such as those from example subprojects) to pub.dev.
2023-04-14 01:41:58 +10:00
hacker1024
04e7ced7e2 mkFlutterApp: Don't fetch prebuilt artifacts
Artifacts are now supplied by the Flutter SDK derivation.

In addition, they are no longer a factor in the dependency hash calculation.
2023-04-13 22:01:42 +10:00
hacker1024
6d50bcc487 mkFlutterApp: Deduplicate build environment setup
The build environment is now set up by the Flutter wrapper, and does not need to be done in mkFlutterApp.
2023-04-13 22:00:24 +10:00
hacker1024
d5aa0c1f97 Merge remote-tracking branch 'NixOS/master' into patch-3 2023-04-13 19:22:50 +10:00
Artturin
f9fdf2d402 treewide: move NIX_CFLAGS_COMPILE to the env attrset
with structuredAttrs lists will be bash arrays which cannot be exported
which will be a issue with some patches and some wrappers like cc-wrapper

this makes it clearer that NIX_CFLAGS_COMPILE must be a string as lists
in env cause a eval failure
2023-02-22 21:23:04 +02:00
Artturin
2eeb34c273 treewide: {build,host,target}Platform -> stdenv.{build,host,target}Platform 2023-01-09 21:13:22 +02:00
Luke Granger-Brown
8a4ef88653 mkFlutterApp: support apps which don't produce a .packages 2022-12-02 03:22:52 +00:00
hacker1024
43d1e2ebf4 flutter.mkFlutterApp: Don't use .packages
This file is deprecated, unused, and not generated in newer Flutter versions.
2022-11-14 21:21:22 +11:00
hacker1024
b180cb467b flutter.mkFlutterApp: Use wrapped Flutter package during build
This ensures that all runtime dependencies are supplied.
2022-11-14 21:20:34 +11:00
Maciej Krüger
0bd82b7767
flutter.mkFlutterApp: fix installing .desktop
Previously this was pulling from $built, which got moved to $out/app,
so the glob didn't do anything. Now uses find on $out/app
2022-02-23 15:10:59 +01:00
Maciej Krüger
1495ce56ba
flutter.mkFlutterApp: allow extra fetch commands
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2022-02-23 15:10:57 +01:00
Maciej Krüger
847b557ef3
flutter.mkFlutterApp: disable fetch buildPhase
Otherwise it tries to run some other commands, this prevents that

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2022-02-23 15:02:43 +01:00
Maciej Krüger
fd41185d86
flutter.mkFlutterApp: init
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2022-02-19 15:07:41 +01:00