···4545This can be done in `preBuild`, in one of two ways:
464647471. Packaging the tool with `buildDartApplication`, adding it to Nixpkgs, and running it like any other application
4848-2. Running the tool from the Pub cache
4848+2. Running the tool from the package cache
49495050Of these methods, the first is recommended when using a tool that does not need
5151to be of a specific version.
52525353-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`.
5353+For the second method, the `packageRun` function from the `dartConfigHook` can be used.
5454+This is an alternative to `dart run` that does not rely on Pub.
54555556e.g., for `build_runner`:
56575758```bash
5858-dart --packages=.dart_tool/package_config.json ${self.pubspecLock.dependencySources.build_runner.packagePath}/bin/build_runner.dart build
5959+packageRun build_runner -- build
5960```
60616162Do _not_ use `dart run <package_name>`, as this will attempt to download dependencies with Pub.