build-graalvm-native-image: pass whole environment

Pass the whole environment to the native-image build process by
generating a -E option for every environment variable.

This has the same effect as setting
NATIVE_IMAGE_DEPRECATED_BUILDER_SANITATION=true
but is compatible with packages providing -E options themselves
This commit is contained in:
sohalt 2024-01-22 17:48:14 +01:00
parent 2f6981d6e1
commit 9d353905ea

View File

@ -52,7 +52,7 @@ stdenv.mkDerivation ({
buildPhase = args.buildPhase or ''
runHook preBuild
native-image -jar "$jar" ''${nativeImageBuildArgs[@]}
native-image -jar "$jar" $(export -p | sed -n 's/^declare -x \([^=]\+\)=.*$/ -E\1/p' | tr -d \\n) ''${nativeImageBuildArgs[@]}
runHook postBuild
'';