mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-12 16:53:21 +00:00
flutter: Move artifact installation logic to the wrapper
This commit is contained in:
parent
dfdce9c1d4
commit
b1efbff8ec
@ -34,15 +34,15 @@ let
|
||||
inherit wrapFlutter mkCustomFlutter mkFlutter;
|
||||
buildFlutterApplication = callPackage ../../../build-support/flutter {
|
||||
# Package a minimal version of Flutter that only uses Linux desktop release artifacts.
|
||||
flutter = wrapFlutter
|
||||
(mkCustomFlutter (args // {
|
||||
includedEngineArtifacts = {
|
||||
common = [ "flutter_patched_sdk_product" ];
|
||||
platform.linux = lib.optionals stdenv.hostPlatform.isLinux
|
||||
(lib.genAttrs ((lib.optional stdenv.hostPlatform.isx86_64 "x64") ++ (lib.optional stdenv.hostPlatform.isAarch64 "arm64"))
|
||||
(architecture: [ "release" ]));
|
||||
};
|
||||
}));
|
||||
flutter = (wrapFlutter (mkCustomFlutter args)).override {
|
||||
supportsAndroid = false;
|
||||
includedEngineArtifacts = {
|
||||
common = [ "flutter_patched_sdk_product" ];
|
||||
platform.linux = lib.optionals stdenv.hostPlatform.isLinux
|
||||
(lib.genAttrs ((lib.optional stdenv.hostPlatform.isx86_64 "x64") ++ (lib.optional stdenv.hostPlatform.isAarch64 "arm64"))
|
||||
(architecture: [ "release" ]));
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
|
@ -8,13 +8,7 @@
|
||||
"flutter_patched_sdk"
|
||||
"flutter_patched_sdk_product"
|
||||
];
|
||||
platform = {
|
||||
android = lib.optionalAttrs stdenv.hostPlatform.isx86_64
|
||||
((lib.genAttrs [ "arm" "arm64" "x64" ] (architecture: [ "profile" "release" ])) // { x86 = [ "jit-release" ]; });
|
||||
linux = lib.optionals stdenv.hostPlatform.isLinux
|
||||
(lib.genAttrs ((lib.optional stdenv.hostPlatform.isx86_64 "x64") ++ (lib.optional stdenv.hostPlatform.isAarch64 "arm64"))
|
||||
(architecture: [ "debug" "profile" "release" ]));
|
||||
};
|
||||
platform = { };
|
||||
}
|
||||
|
||||
, lib
|
||||
|
@ -2,7 +2,9 @@
|
||||
, stdenv
|
||||
, callPackage
|
||||
, flutter
|
||||
, supportsLinuxDesktop ? stdenv.isLinux
|
||||
, supportsLinuxDesktop ? stdenv.hostPlatform.isLinux
|
||||
, supportsAndroid ? stdenv.hostPlatform.isx86_64
|
||||
, includedEngineArtifacts ? null
|
||||
, extraPkgConfigPackages ? [ ]
|
||||
, extraLibraries ? [ ]
|
||||
, extraIncludes ? [ ]
|
||||
@ -33,11 +35,27 @@
|
||||
}:
|
||||
|
||||
let
|
||||
flutterWithArtifacts = flutter.override {
|
||||
includedEngineArtifacts = if includedEngineArtifacts != null then includedEngineArtifacts else {
|
||||
common = [
|
||||
"flutter_patched_sdk"
|
||||
"flutter_patched_sdk_product"
|
||||
];
|
||||
platform = {
|
||||
android = lib.optionalAttrs supportsAndroid
|
||||
((lib.genAttrs [ "arm" "arm64" "x64" ] (architecture: [ "profile" "release" ])) // { x86 = [ "jit-release" ]; });
|
||||
linux = lib.optionalAttrs supportsLinuxDesktop
|
||||
(lib.genAttrs ((lib.optional stdenv.hostPlatform.isx86_64 "x64") ++ (lib.optional stdenv.hostPlatform.isAarch64 "arm64"))
|
||||
(architecture: [ "debug" "profile" "release" ]));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# By default, Flutter stores downloaded files (such as the Pub cache) in the SDK directory.
|
||||
# Wrap it to ensure that it does not do that, preferring home directories instead.
|
||||
immutableFlutter = writeShellScript "flutter_immutable" ''
|
||||
export PUB_CACHE=''${PUB_CACHE:-"$HOME/.pub-cache"}
|
||||
${flutter}/bin/flutter "$@"
|
||||
${flutterWithArtifacts}/bin/flutter "$@"
|
||||
'';
|
||||
|
||||
# Tools that the Flutter tool depends on.
|
||||
@ -87,12 +105,12 @@ in
|
||||
{
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
passthru = flutter.passthru // {
|
||||
inherit (flutter) version;
|
||||
unwrapped = flutter;
|
||||
passthru = flutterWithArtifacts.passthru // {
|
||||
inherit (flutterWithArtifacts) version;
|
||||
unwrapped = flutterWithArtifacts;
|
||||
};
|
||||
|
||||
inherit (flutter) meta;
|
||||
inherit (flutterWithArtifacts) meta;
|
||||
} ''
|
||||
for path in ${builtins.concatStringsSep " " (builtins.foldl' (paths: pkg: paths ++ (map (directory: "'${pkg}/${directory}/pkgconfig'") ["lib" "share"])) [ ] pkgConfigPackages)}; do
|
||||
addToSearchPath FLUTTER_PKG_CONFIG_PATH "$path"
|
||||
|
Loading…
Reference in New Issue
Block a user