about summary refs log tree commit diff
path: root/pkgs/development/compilers/graalvm/community-edition/mkGraal.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/graalvm/community-edition/mkGraal.nix')
-rw-r--r--pkgs/development/compilers/graalvm/community-edition/mkGraal.nix45
1 files changed, 37 insertions, 8 deletions
diff --git a/pkgs/development/compilers/graalvm/community-edition/mkGraal.nix b/pkgs/development/compilers/graalvm/community-edition/mkGraal.nix
index 8f4aaba44f088..77f0fa9b7dc5e 100644
--- a/pkgs/development/compilers/graalvm/community-edition/mkGraal.nix
+++ b/pkgs/development/compilers/graalvm/community-edition/mkGraal.nix
@@ -1,7 +1,36 @@
-{ javaVersion
+{
+  # An attrset describing each platform configuration. All values are extract
+  # from the GraalVM releases available on
+  # https://github.com/graalvm/graalvm-ce-builds/releases
+  # Example:
+  # config = {
+  #   x86_64-linux = {
+  #     # List of products that will be included in the GraalVM derivation
+  #     # See `with{NativeImage,Ruby,Python,WASM,*}Svm` variables for the
+  #     # available values
+  #     products = [ "graalvm-ce" "native-image-installable-svm" ];
+  #     # GraalVM arch, not to be confused with the nix platform
+  #     arch = "linux-amd64";
+  #     # GraalVM version
+  #     version = "22.0.0.2";
+  #   };
+  # }
+  config
+  # GraalVM version that will be used unless overriden by `config.<platform>.version`
 , defaultVersion
-, platforms
-, config
+  # Java version used by GraalVM
+, javaVersion
+  # Platforms were GraalVM will be allowed to build (i.e. `meta.platforms`)
+, platforms ? builtins.attrNames config
+  # If set to true, update script will (re-)generate the sources file even if
+  # there are no updates available
+, forceUpdate ? false
+  # Path for the sources file that will be used
+  # See `update.nix` file for a description on how this file works
+, sourcesPath ? ./. + "/graalvm${javaVersion}-ce-sources.json"
+  # Use musl instead of glibc to allow true static builds in GraalVM's
+  # Native Image (i.e.: `--static --libc=musl`). This will cause glibc builds
+  # to fail, so it should be used with care
 , useMusl ? false
 }:
 
@@ -32,10 +61,11 @@
 , gtkSupport ? stdenv.isLinux
 , cairo
 , glib
+  # updateScript deps
+, gnused
 , gtk3
-, writeShellScript
 , jq
-, gnused
+, writeShellScript
 }:
 
 assert useMusl -> stdenv.isLinux;
@@ -44,8 +74,7 @@ let
   platform = config.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
   version = platform.version or defaultVersion;
   name = "graalvm${javaVersion}-ce";
-  sourcesFilename = "${name}-sources.json";
-  sources = builtins.fromJSON (builtins.readFile (./. + "/${sourcesFilename}"));
+  sources = builtins.fromJSON (builtins.readFile sourcesPath);
 
   runtimeLibraryPath = lib.makeLibraryPath
     ([ cups ] ++ lib.optionals gtkSupport [ cairo glib gtk3 ]);
@@ -285,7 +314,7 @@ let
       inherit (platform) products;
       home = graalvmXXX-ce;
       updateScript = import ./update.nix {
-        inherit lib writeShellScript jq sourcesFilename name config gnused defaultVersion;
+        inherit config defaultVersion forceUpdate gnused jq lib name sourcesPath writeShellScript;
         graalVersion = version;
         javaVersion = "java${javaVersion}";
       };