mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 19:55:41 +03:00
flutter.buildFlutterApplication: Add multiShell attribute
This commit is contained in:
parent
e3b2edadef
commit
3b33435d02
2 changed files with 21 additions and 5 deletions
|
@ -80,6 +80,8 @@ Do _not_ use `dart run <package_name>`, as this will attempt to download depende
|
|||
|
||||
### Usage with nix-shell {#ssec-dart-applications-nix-shell}
|
||||
|
||||
#### Using dependencies from the Nix store {#ssec-dart-applications-nix-shell-deps}
|
||||
|
||||
As `buildDartApplication` provides dependencies instead of `pub get`, Dart needs to be explicitly told where to find them.
|
||||
|
||||
Run the following commands in the source directory to configure Dart appropriately.
|
||||
|
@ -120,4 +122,15 @@ flutter.buildFlutterApplication {
|
|||
|
||||
### Usage with nix-shell {#ssec-dart-flutter-nix-shell}
|
||||
|
||||
See the [Dart documentation](#ssec-dart-applications-nix-shell) for nix-shell instructions.
|
||||
Flutter-specific `nix-shell` usage notes are included here. See the [Dart documentation](#ssec-dart-applications-nix-shell) for general `nix-shell` instructions.
|
||||
|
||||
#### Entering the shell {#ssec-dart-flutter-nix-shell-enter}
|
||||
|
||||
By default, dependencies for only the `flutterHostPlatform` are available in the
|
||||
build environment. This is useful for keeping closures small, but be problematic
|
||||
during development. It's common, for example, to build Web apps for Linux during
|
||||
development to take advantage of native features such as stateful hot reload.
|
||||
|
||||
To enter a shell with all the usual target platforms available, use the `multiShell` attribute.
|
||||
|
||||
e.g. `nix-shell '<nixpkgs>' -A fluffychat-web.multiShell`.
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
}@args:
|
||||
|
||||
let
|
||||
hostPlatforms = rec {
|
||||
builderArgs = rec {
|
||||
universal = args // {
|
||||
sdkSetupScript = ''
|
||||
# Pub needs SSL certificates. Dart normally looks in a hardcoded path.
|
||||
|
@ -170,7 +170,10 @@ let
|
|||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
};
|
||||
}.${flutterHostPlatform} or (throw "Unsupported Flutter host platform: ${flutterHostPlatform}");
|
||||
|
||||
minimalFlutter = flutter.override { supportedTargetFlutterPlatforms = [ "universal" flutterHostPlatform ]; };
|
||||
|
||||
buildAppWith = flutter: buildDartApplication.override { dart = flutter; };
|
||||
in
|
||||
(buildDartApplication.override { dart = flutter.override { supportedTargetFlutterPlatforms = [ "universal" flutterHostPlatform ]; }; })
|
||||
hostPlatforms.${flutterHostPlatform} or (throw "Unsupported Flutter host platform: ${flutterHostPlatform}")
|
||||
buildAppWith minimalFlutter (builderArgs // { passthru = builderArgs.passthru or { } // { multiShell = buildAppWith flutter builderArgs; }; })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue