buildGraalvmNativeImage: allow usage of arbitrary graalvm derivation

This will allow for easier overrides for specific systems (e.g.
`aarch64-linux` that is only supported in `graalvm17-ce`).
This commit is contained in:
Thiago Kenji Okada 2022-03-31 22:35:44 +01:00
parent ccc400a41f
commit bdfff535f0
2 changed files with 8 additions and 6 deletions

View File

@ -1,4 +1,4 @@
{ lib, stdenv, graalvmCEPackages, glibcLocales }:
{ lib, stdenv, graalvm, glibcLocales }:
{ name ? "${args.pname}-${args.version}"
# Final executable name
@ -19,8 +19,8 @@
, extraNativeImageBuildArgs ? [ ]
# XMX size of GraalVM during build
, graalvmXmx ? "-J-Xmx6g"
# The GraalVM to use
, graalvm ? graalvmCEPackages.graalvm11-ce
# The GraalVM derivation to use
, graalvmDrv ? graalvm
, meta ? { }
, ...
} @ args:
@ -28,7 +28,7 @@
stdenv.mkDerivation (args // {
inherit dontUnpack;
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ graalvm glibcLocales ];
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ graalvmDrv glibcLocales ];
nativeImageBuildArgs = nativeImageBuildArgs ++ extraNativeImageBuildArgs ++ [ graalvmXmx ];
@ -52,7 +52,7 @@ stdenv.mkDerivation (args // {
meta = {
# default to graalvm's platforms
platforms = graalvm.meta.platforms;
platforms = graalvmDrv.meta.platforms;
# default to executable name
mainProgram = executable;
} // meta;

View File

@ -12866,7 +12866,9 @@ with pkgs;
});
graalvm11-ce = graalvmCEPackages.graalvm11-ce;
graalvm17-ce = graalvmCEPackages.graalvm17-ce;
buildGraalvmNativeImage = callPackage ../build-support/build-graalvm-native-image { };
buildGraalvmNativeImage = callPackage ../build-support/build-graalvm-native-image {
graalvm = graalvm11-ce;
};
inherit (callPackages ../development/compilers/graalvm/enterprise-edition.nix { })
graalvm8-ee