flutter.buildFlutterApplication: Allow overriding configuration attributes

This allows thing like `flutterBuildFlags` and `runtimeDependencies` to be overridden with `overrideAttrs`.

Attributes that affect dependency retrieval cannot be overridden.
This commit is contained in:
hacker1024 2023-04-17 02:48:10 +10:00
parent 87f809e0c6
commit 329c494d0c

View File

@ -30,8 +30,11 @@ let
inherit pubGetScript vendorHash pubspecLockFile;
buildDrvArgs = args;
};
self =
(self: llvmPackages_13.stdenv.mkDerivation (args // {
in
llvmPackages_13.stdenv.mkDerivation (finalAttrs: args // {
inherit flutterBuildFlags runtimeDependencies;
outputs = [ "out" "debug" ];
nativeBuildInputs = [
@ -54,7 +57,7 @@ let
mkdir -p build/flutter_assets/fonts
flutter packages get --offline -v
flutter build linux -v --release --split-debug-info="$debug" ${builtins.concatStringsSep " " (map (flag: "\"${flag}\"") flutterBuildFlags)}
flutter build linux -v --release --split-debug-info="$debug" ${builtins.concatStringsSep " " (map (flag: "\"${flag}\"") finalAttrs.flutterBuildFlags)}
runHook postBuild
'';
@ -98,11 +101,9 @@ let
# which is not what application authors expect.
for f in "$out"/bin/*; do
wrapProgram "$f" \
--suffix LD_LIBRARY_PATH : '${lib.makeLibraryPath runtimeDependencies}'
--suffix LD_LIBRARY_PATH : '${lib.makeLibraryPath finalAttrs.runtimeDependencies}'
done
${postFixup}
'';
})) self;
in
self
})