diff options
author | hacker1024 <hacker1024@users.sourceforge.net> | 2024-01-10 20:29:53 +1100 |
---|---|---|
committer | hacker1024 <hacker1024@users.sourceforge.net> | 2024-01-10 20:29:53 +1100 |
commit | 778cefd4646ad54b028ec621fa7d2a60b61fef07 (patch) | |
tree | 9a6df6b0004a9466f4eac6076b60f387b1297a6d /pkgs/build-support/dart | |
parent | cf53751a16df6ae52eb3be7019aa9c34017e490b (diff) |
buildDartApplication: Allow reading pubspec.lock with IFD
Diffstat (limited to 'pkgs/build-support/dart')
-rw-r--r-- | pkgs/build-support/dart/build-dart-application/default.nix | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pkgs/build-support/dart/build-dart-application/default.nix b/pkgs/build-support/dart/build-dart-application/default.nix index e8e6bd16b1689..f9a49fec3a2d8 100644 --- a/pkgs/build-support/dart/build-dart-application/default.nix +++ b/pkgs/build-support/dart/build-dart-application/default.nix @@ -1,6 +1,7 @@ { lib , stdenv , callPackage +, runCommand , writeText , pub2nix , dartHooks @@ -9,6 +10,7 @@ , nodejs , darwin , jq +, yq }: { src @@ -44,7 +46,13 @@ , runtimeDependencies ? [ ] , extraWrapProgramArgs ? "" -, pubspecLock + +, autoPubspecLock ? null +, pubspecLock ? if autoPubspecLock == null then + throw "The pubspecLock argument is required. If import-from-derivation is allowed (it isn't in Nixpkgs), you can set autoPubspecLock to the path to a pubspec.lock instead." + else + assert lib.assertMsg (builtins.pathExists autoPubspecLock) "The pubspec.lock file could not be found!"; + lib.importJSON (runCommand "${lib.getName args}-pubspec-lock-json" { nativeBuildInputs = [ yq ]; } ''yq . '${autoPubspecLock}' > "$out"'') , ... }@args: |