buildGraalvmNativeImage: fix UTF-8 encoding issue for JVM dependencies

Now that we can pass build arguments for the GraalVM builder again (see
https://github.com/NixOS/nixpkgs/pull/282901), this should work again.

Fix issue: https://github.com/NixOS/nixpkgs/issues/283953
This commit is contained in:
Thiago Kenji Okada 2024-01-26 11:08:05 +00:00
parent aa7e5cc700
commit 1fee681897
2 changed files with 4 additions and 2 deletions

View file

@ -16,14 +16,13 @@
"-H:Name=${executable}"
"-march=compatibility"
"--verbose"
"-J-Dsun.stdout.encoding=UTF-8"
"-J-Dsun.stderr.encoding=UTF-8"
]
# Extra arguments to be passed to the native-image
, extraNativeImageBuildArgs ? [ ]
# XMX size of GraalVM during build
, graalvmXmx ? "-J-Xmx6g"
, meta ? { }
, LC_ALL ? "en_US.UTF-8"
, ...
} @ args:
@ -45,6 +44,8 @@ in
stdenv.mkDerivation ({
inherit dontUnpack jar;
env = { inherit LC_ALL; };
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ graalvmDrv glibcLocales removeReferencesTo ];
nativeImageBuildArgs = nativeImageBuildArgs ++ extraNativeImageBuildArgs ++ [ graalvmXmx ];

View file

@ -36,6 +36,7 @@ let
$out/bin/bb '(+ 1 2)' | fgrep '3'
$out/bin/bb '(vec (dedupe *input*))' <<< '[1 1 1 1 2]' | fgrep '[1 2]'
$out/bin/bb '(prn "bépo àê")' | fgrep 'bépo àê'
$out/bin/bb '(:out (babashka.process/sh "echo" "ä"))' | fgrep 'ä'
'';
postInstall = ''