From d41348a68a130b5358740e394f50d7fb5fc69838 Mon Sep 17 00:00:00 2001 From: hacker1024 Date: Thu, 26 Oct 2023 19:30:23 +1100 Subject: dartHooks.dartConfigHook: Add packageRun utility --- doc/languages-frameworks/dart.section.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'doc/languages-frameworks/dart.section.md') diff --git a/doc/languages-frameworks/dart.section.md b/doc/languages-frameworks/dart.section.md index 933e7210133a..e5acd9902634 100644 --- a/doc/languages-frameworks/dart.section.md +++ b/doc/languages-frameworks/dart.section.md @@ -45,17 +45,18 @@ Many Dart applications require executables from the `dev_dependencies` section i This can be done in `preBuild`, in one of two ways: 1. Packaging the tool with `buildDartApplication`, adding it to Nixpkgs, and running it like any other application -2. Running the tool from the Pub cache +2. Running the tool from the package cache Of these methods, the first is recommended when using a tool that does not need to be of a specific version. -To use the second method, first make the derivation accessible within itself (e.g. `let self = ...; in self`), and then run it from the Pub cache in `preBuild`. +For the second method, the `packageRun` function from the `dartConfigHook` can be used. +This is an alternative to `dart run` that does not rely on Pub. e.g., for `build_runner`: ```bash -dart --packages=.dart_tool/package_config.json ${self.pubspecLock.dependencySources.build_runner.packagePath}/bin/build_runner.dart build +packageRun build_runner -- build ``` Do _not_ use `dart run `, as this will attempt to download dependencies with Pub. -- cgit 1.4.1