about summary refs log tree commit diff
path: root/doc/languages-frameworks/dart.section.md
diff options
context:
space:
mode:
authorhacker1024 <hacker1024@users.sourceforge.net>2023-10-26 00:40:59 +1100
committerFlafyDev <flafyarazi@gmail.com>2023-12-26 17:06:17 +0200
commit7c7cb9508540480f2bfb2f72406f45d7d737077a (patch)
tree44a3bd9932cc821b55c7a4dfa928e4fd88a0bf16 /doc/languages-frameworks/dart.section.md
parent34ce9c64c9c123afb16def28966858fe41b955c4 (diff)
downloadnixlib-7c7cb9508540480f2bfb2f72406f45d7d737077a.tar
nixlib-7c7cb9508540480f2bfb2f72406f45d7d737077a.tar.gz
nixlib-7c7cb9508540480f2bfb2f72406f45d7d737077a.tar.bz2
nixlib-7c7cb9508540480f2bfb2f72406f45d7d737077a.tar.lz
nixlib-7c7cb9508540480f2bfb2f72406f45d7d737077a.tar.xz
nixlib-7c7cb9508540480f2bfb2f72406f45d7d737077a.tar.zst
nixlib-7c7cb9508540480f2bfb2f72406f45d7d737077a.zip
dart: Update documentation for pub2nix
Diffstat (limited to 'doc/languages-frameworks/dart.section.md')
-rw-r--r--doc/languages-frameworks/dart.section.md15
1 files changed, 7 insertions, 8 deletions
diff --git a/doc/languages-frameworks/dart.section.md b/doc/languages-frameworks/dart.section.md
index 9da43714a164..520178de26ec 100644
--- a/doc/languages-frameworks/dart.section.md
+++ b/doc/languages-frameworks/dart.section.md
@@ -4,13 +4,14 @@
 
 The function `buildDartApplication` builds Dart applications managed with pub.
 
-It fetches its Dart dependencies automatically through `fetchDartDeps`, and (through a series of hooks) builds and installs the executables specified in the pubspec file. The hooks can be used in other derivations, if needed. The phases can also be overridden to do something different from installing binaries.
+It fetches its Dart dependencies automatically through `pub2nix`, and (through a series of hooks) builds and installs the executables specified in the pubspec file. The hooks can be used in other derivations, if needed. The phases can also be overridden to do something different from installing binaries.
 
 If you are packaging a Flutter desktop application, use [`buildFlutterApplication`](#ssec-dart-flutter) instead.
 
-`vendorHash`: is the hash of the output of the dependency fetcher derivation. To obtain it, set it to `lib.fakeHash` (or omit it) and run the build ([more details here](#sec-source-hashes)).
+`pubspecLock` is the parsed pubspec.lock file. pub2nix uses this to download required packages.
+This can be converted to JSON from YAML with something like `yq . pubspec.lock`, and then read by Nix.
 
-If the upstream source is missing a `pubspec.lock` file, you'll have to vendor one and specify it using `pubspecLockFile`. If it is needed, one will be generated for you and printed when attempting to build the derivation.
+If the package has Git package dependencies, the hashes must be provided in the `gitHashes` set. If a hash is missing, an error message prompting you to add it will be shown.
 
 The `depsListFile` must always be provided when packaging in Nixpkgs. It will be generated and printed if the derivation is attempted to be built without one. Alternatively, `autoDepsList` may be set to `true` only when outside of Nixpkgs, as it relies on import-from-derivation.
 
@@ -19,7 +20,7 @@ The `dart` commands run can be overridden through `pubGetScript` and `dartCompil
 Dart supports multiple [outputs types](https://dart.dev/tools/dart-compile#types-of-output), you can choose between them using `dartOutputType` (defaults to `exe`). If you want to override the binaries path or the source path they come from, you can use `dartEntryPoints`. Outputs that require a runtime will automatically be wrapped with the relevant runtime (`dartaotruntime` for `aot-snapshot`, `dart run` for `jit-snapshot` and `kernel`, `node` for `js`), this can be overridden through `dartRuntimeCommand`.
 
 ```nix
-{ buildDartApplication, fetchFromGitHub }:
+{ lib, buildDartApplication, fetchFromGitHub }:
 
 buildDartApplication rec {
   pname = "dart-sass";
@@ -32,9 +33,8 @@ buildDartApplication rec {
     hash = "sha256-U6enz8yJcc4Wf8m54eYIAnVg/jsGi247Wy8lp1r1wg4=";
   };
 
-  pubspecLockFile = ./pubspec.lock;
+  pubspecLock = lib.importJSON ./pubspec.lock.json;
   depsListFile = ./deps.json;
-  vendorHash = "sha256-Atm7zfnDambN/BmmUf4BG0yUz/y6xWzf0reDw3Ad41s=";
 }
 ```
 
@@ -59,8 +59,7 @@ flutter.buildFlutterApplication {
     fetchSubmodules = true;
   };
 
-  pubspecLockFile = ./pubspec.lock;
+  pubspecLock = lib.importJSON ./pubspec.lock.json;
   depsListFile = ./deps.json;
-  vendorHash = "sha256-cdMO+tr6kYiN5xKXa+uTMAcFf2C75F3wVPrn21G4QPQ=";
 }
 ```