From 1fee681897d23c1978edec0958eee66450cb3b1c Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Fri, 26 Jan 2024 11:08:05 +0000 Subject: [PATCH] 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 --- pkgs/build-support/build-graalvm-native-image/default.nix | 5 +++-- pkgs/development/interpreters/babashka/default.nix | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/build-support/build-graalvm-native-image/default.nix b/pkgs/build-support/build-graalvm-native-image/default.nix index 815c2bf14aae..f0e73901c8db 100644 --- a/pkgs/build-support/build-graalvm-native-image/default.nix +++ b/pkgs/build-support/build-graalvm-native-image/default.nix @@ -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 ]; diff --git a/pkgs/development/interpreters/babashka/default.nix b/pkgs/development/interpreters/babashka/default.nix index d548dee0345b..99528c2d7639 100644 --- a/pkgs/development/interpreters/babashka/default.nix +++ b/pkgs/development/interpreters/babashka/default.nix @@ -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 = ''