buildDartApplication: Supply CA bundle to Dart in FOD

DART_VM_OPTIONS is not effective.
This commit is contained in:
hacker1024 2023-08-28 12:28:31 +10:00
parent 0606fd6732
commit 1dcba055e5
2 changed files with 9 additions and 9 deletions

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchDartDeps, writeText, dartHooks, makeWrapper, dart, nodejs, darwin }:
{ lib, stdenv, fetchDartDeps, runCommand, writeText, dartHooks, makeWrapper, dart, cacert, nodejs, darwin }:
{ pubGetScript ? "dart pub get"
@ -30,7 +30,13 @@
}@args:
let
dartDeps = fetchDartDeps {
dartDeps = (fetchDartDeps.override {
dart = runCommand "dart-fod" { nativeBuildInputs = [ makeWrapper ]; } ''
mkdir -p "$out/bin"
makeWrapper "${dart}/bin/dart" "$out/bin/dart" \
--add-flags "--root-certs-file=${cacert}/etc/ssl/certs/ca-bundle.crt"
'';
}) {
buildDrvArgs = args;
inherit pubGetScript vendorHash pubspecLockFile;
};

View File

@ -79,13 +79,7 @@ let
installPhase = ''
_pub_get() {
(
# Dart does not respect SSL_CERT_FILE.
# https://github.com/dart-lang/sdk/issues/48506
export DART_VM_OPTIONS="--root-certs-file=$SSL_CERT_FILE"
${pubGetScript}
)
${pubGetScript}
}
# so we can use lock, diff yaml