From 7c9b7547846189255b2f37eb604be2d2fd2000f8 Mon Sep 17 00:00:00 2001 From: hacker1024 Date: Thu, 26 Oct 2023 15:47:08 +1100 Subject: [PATCH] buildDartApplication: Document nix-shell usage --- doc/languages-frameworks/dart.section.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/languages-frameworks/dart.section.md b/doc/languages-frameworks/dart.section.md index 520178de26ec..5c279a14170e 100644 --- a/doc/languages-frameworks/dart.section.md +++ b/doc/languages-frameworks/dart.section.md @@ -38,6 +38,18 @@ buildDartApplication rec { } ``` +### Usage with nix-shell + +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. +Do not use `pub` after doing so; it will download the dependencies itself and overwrite these changes. + +```bash +cp --no-preserve=all "$pubspecLockFilePath" pubspec.lock +mkdir -p .dart_tool && cp --no-preserve=all "$packageConfig" .dart_tool/package_config.json +``` + ## Flutter applications {#ssec-dart-flutter} The function `buildFlutterApplication` builds Flutter applications. @@ -62,4 +74,8 @@ flutter.buildFlutterApplication { pubspecLock = lib.importJSON ./pubspec.lock.json; depsListFile = ./deps.json; } + +### Usage with nix-shell + +See the [Dart documentation](#ssec-dart-applications) nix-shell instructions. ```