Skip to content

Commit

Permalink
buildGraalvmNativeImage: allow nativeImageBuildArgs to be overwritten
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Nov 25, 2021
1 parent f1c1618 commit a5c0f59
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkgs/build-support/build-graalvm-native-image/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
# JAR used as input for GraalVM derivation, defaults to src
, jar ? args.src
, dontUnpack ? (jar == args.src)
# Default native-image arguments. You probably don't want to set this,
# except in special cases. In most cases, use extraNativeBuildArgs instead
, nativeImageBuildArgs ? [
"-jar" jar
"-H:CLibraryPath=${lib.getLib graalvm}/lib"
(lib.optionalString stdenv.isDarwin "-H:-CheckToolchain")
"-H:Name=${executable}"
"--verbose"
]
# Extra arguments to be passed to the native-image
, extraNativeImageBuildArgs ? [ ]
# XMX size of GraalVM during build
Expand All @@ -20,16 +29,7 @@ stdenv.mkDerivation (args // {

nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ graalvm glibcLocales ];

nativeImageBuildArgs = lib.flatten ([
"-jar"
jar
"-H:CLibraryPath=${lib.getLib graalvm}/lib"
"${lib.optionalString stdenv.isDarwin "-H:-CheckToolchain"}"
"-H:Name=${executable}"
"--verbose"
extraNativeImageBuildArgs
graalvmXmx
]);
nativeImageBuildArgs = nativeImageBuildArgs ++ extraNativeImageBuildArgs ++ [ graalvmXmx ];

buildPhase = args.buildPhase or ''
runHook preBuild
Expand Down

0 comments on commit a5c0f59

Please sign in to comment.