From 5391c0204e54b0d1852415108f20ad316f20cdaf Mon Sep 17 00:00:00 2001 From: hacker1024 Date: Sat, 21 Oct 2023 22:37:01 +1100 Subject: [PATCH] buildDartApplication: Allow passing a `sdkSetupScript` --- .../dart/build-dart-application/default.nix | 9 +++++---- .../build-dart-application/hooks/dart-config-hook.sh | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/dart/build-dart-application/default.nix b/pkgs/build-support/dart/build-dart-application/default.nix index 6992c79a37ed..7920a3d61a7a 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, fetchDartDeps, runCommand, writeText, dartHooks, makeWrapper, dart, cacert, nodejs, darwin, jq }: -{ pubGetScript ? "dart pub get" +{ sdkSetupScript ? "" +, pubGetScript ? "dart pub get" # Output type to produce. Can be any kind supported by dart # https://dart.dev/tools/dart-compile#types-of-output @@ -41,13 +42,13 @@ let ''; }) { buildDrvArgs = args; - inherit pubGetScript vendorHash pubspecLockFile; + inherit sdkSetupScript pubGetScript vendorHash pubspecLockFile; }; inherit (dartHooks.override { inherit dart; }) dartConfigHook dartBuildHook dartInstallHook dartFixupHook; baseDerivation = stdenv.mkDerivation (finalAttrs: args // { - inherit pubGetScript dartCompileCommand dartOutputType dartRuntimeCommand - dartCompileFlags dartJitFlags runtimeDependencies; + inherit sdkSetupScript pubGetScript dartCompileCommand dartOutputType + dartRuntimeCommand dartCompileFlags dartJitFlags runtimeDependencies; dartEntryPoints = if (dartEntryPoints != null) diff --git a/pkgs/build-support/dart/build-dart-application/hooks/dart-config-hook.sh b/pkgs/build-support/dart/build-dart-application/hooks/dart-config-hook.sh index 3e901995237d..f22d7d2ce64d 100644 --- a/pkgs/build-support/dart/build-dart-application/hooks/dart-config-hook.sh +++ b/pkgs/build-support/dart/build-dart-application/hooks/dart-config-hook.sh @@ -3,6 +3,9 @@ dartConfigHook() { echo "Executing dartConfigHook" + echo "Setting up SDK" + eval "$sdkSetupScript" + echo "Installing dependencies" eval doPubGet "$pubGetScript" --offline