7 # The GraalVM derivation to use
10 executable ? args.pname,
11 # JAR used as input for GraalVM derivation, defaults to src
13 dontUnpack ? (jar == args.src),
14 # Default native-image arguments. You probably don't want to set this,
15 # except in special cases. In most cases, use extraNativeBuildArgs instead
16 nativeImageBuildArgs ? [
17 (lib.optionalString stdenv.hostPlatform.isDarwin "-H:-CheckToolchain")
19 stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64
21 "-H:Name=${executable}"
22 "-march=compatibility"
25 # Extra arguments to be passed to the native-image
26 extraNativeImageBuildArgs ? [ ],
27 # XMX size of GraalVM during build
28 graalvmXmx ? "-J-Xmx6g",
30 LC_ALL ? "en_US.UTF-8",
35 extraArgs = builtins.removeAttrs args [
39 "darwinMinVersionHook"
53 inherit dontUnpack jar;
55 env = { inherit LC_ALL; };
57 nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [
63 buildInputs = lib.optionals (stdenv.hostPlatform.isDarwin) [
65 (darwinMinVersionHook "11.0")
68 nativeImageBuildArgs = nativeImageBuildArgs ++ extraNativeImageBuildArgs ++ [ graalvmXmx ];
74 native-image -jar "$jar" ''${nativeImageBuildArgs[@]}
80 args.installPhase or ''
83 install -Dm755 ${executable} -t $out/bin
89 remove-references-to -t ${graalvmDrv} $out/bin/${executable}
90 ${args.postInstall or ""}
93 disallowedReferences = [ graalvmDrv ];
95 passthru = { inherit graalvmDrv; };
98 # default to graalvm's platforms
99 platforms = graalvmDrv.meta.platforms;
100 # default to executable name
101 mainProgram = executable;