diff --git a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix index 3a72aa72cd72..a3dc2691830a 100644 --- a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix @@ -23,10 +23,10 @@ let runtimeLibraryPath = lib.makeLibraryPath ([ cups ] ++ lib.optionals gtkSupport [ cairo glib gtk3 ]); - mapProducts = key: default: (map (p: p.${key} or default) products); + mapProducts = key: default: (map (p: p.graalvmPhases.${key} or default) products); concatProducts = key: lib.concatStringsSep "\n" (mapProducts key ""); - graalvmXXX-ce = stdenv.mkDerivation (args // { + graalvmXXX-ce = stdenv.mkDerivation ({ pname = "graalvm${javaVersion}-ce"; unpackPhase = '' @@ -146,5 +146,5 @@ let mainProgram = "java"; maintainers = with maintainers; teams.graalvm-ce.members ++ [ ]; } // meta); - }); + } // (builtins.removeAttrs args [ "javaVersion" "meta" "products" ])); in graalvmXXX-ce diff --git a/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix b/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix index 5ec1b4062777..de1f75249e47 100644 --- a/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix +++ b/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix @@ -9,13 +9,14 @@ }: { product , javaVersion -, extraNativeBuildInputs ? [ ] , extraBuildInputs ? [ ] +, extraNativeBuildInputs ? [ ] +, graalvmPhases ? { } , meta ? { } , passthru ? { } , ... } @ args: -stdenv.mkDerivation (args // { +stdenv.mkDerivation ({ pname = "${product}-java${javaVersion}"; nativeBuildInputs = [ perl unzip makeWrapper ] @@ -56,16 +57,27 @@ stdenv.mkDerivation (args // { dontInstall = true; dontBuild = true; dontStrip = true; - # installCheckPhase is going to run in GraalVM main derivation (see buildGraalvm.nix) - # to make sure that it has everything it needs to run correctly. - # Other hooks like fixupPhase/installPhase are also going to run there for the - # same reason. - doInstallCheck = false; - passthru = { inherit product; } // passthru; + passthru = { + inherit product javaVersion; + # build phases that are going to run during GraalVM derivation build, + # since they depend in having the fully setup GraalVM environment + # e.g.: graalvmPhases.installCheckPhase will run the checks only after + # GraalVM+products is build + # see buildGraalvm.nix file for the available phases + inherit graalvmPhases; + } // passthru; meta = with lib; ({ inherit (graalvm-ce.meta) homepage license sourceProvenance maintainers platforms; description = "High-Performance Polyglot VM (Product: ${product})"; } // meta); -}) +} // (builtins.removeAttrs args [ + "product" + "javaVersion" + "extraBuildInputs" + "extraNativeBuildInputs" + "graalvmPhases" + "meta" + "passthru" +])) diff --git a/pkgs/development/compilers/graalvm/community-edition/llvm-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/llvm-installable-svm.nix index c831d8119877..96b9ee9635a5 100644 --- a/pkgs/development/compilers/graalvm/community-edition/llvm-installable-svm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/llvm-installable-svm.nix @@ -15,7 +15,7 @@ graalvmCEPackages.buildGraalvmProduct rec { ''; # TODO: improve this test - installCheckPhase = '' + graalvmPhases.installCheckPhase = '' echo "Testing llvm" $out/bin/lli --help ''; diff --git a/pkgs/development/compilers/graalvm/community-edition/native-image-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/native-image-installable-svm.nix index 393a226df19c..6d1c58d4b114 100644 --- a/pkgs/development/compilers/graalvm/community-edition/native-image-installable-svm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/native-image-installable-svm.nix @@ -27,14 +27,14 @@ graalvmCEPackages.buildGraalvmProduct rec { inherit src javaVersion version; product = "native-image-installable-svm"; - postInstall = lib.optionalString stdenv.isLinux '' + graalvmPhases.postInstall = lib.optionalString stdenv.isLinux '' wrapProgram $out/bin/native-image \ --prefix PATH : ${binPath} \ ${lib.concatStringsSep " " (map (l: "--add-flags '-H:CLibraryPath=${l}/lib'") cLibs)} ''; - installCheckPhase = '' + graalvmPhases.installCheckPhase = '' echo "Ahead-Of-Time compilation" $out/bin/native-image -H:-CheckToolchain -H:+ReportExceptionStackTraces HelloWorld ./helloworld | fgrep 'Hello World' diff --git a/pkgs/development/compilers/graalvm/community-edition/python-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/python-installable-svm.nix index 50821f79efc4..43d6e85ef560 100644 --- a/pkgs/development/compilers/graalvm/community-edition/python-installable-svm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/python-installable-svm.nix @@ -10,7 +10,7 @@ graalvmCEPackages.buildGraalvmProduct rec { inherit src javaVersion version; product = "python-installable-svm"; - installCheckPhase = '' + graalvmPhases.installCheckPhase = '' echo "Testing GraalPython" $out/bin/graalpy -c 'print(1 + 1)' echo '1 + 1' | $out/bin/graalpy diff --git a/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix index 4d00ef43c685..e7f8f157db9e 100644 --- a/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix @@ -24,7 +24,7 @@ graalvmCEPackages.buildGraalvmProduct rec { --replace-needed libcrypto.so.10 libcrypto.so ''; - installCheckPhase = '' + graalvmPhases.installCheckPhase = '' echo "Testing TruffleRuby" # Hide warnings about wrong locale export LANG=C diff --git a/pkgs/development/compilers/graalvm/community-edition/wasm-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/wasm-installable-svm.nix index 6cf6cdb1d6ed..9a5bef7c1e35 100644 --- a/pkgs/development/compilers/graalvm/community-edition/wasm-installable-svm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/wasm-installable-svm.nix @@ -12,7 +12,7 @@ graalvmCEPackages.buildGraalvmProduct rec { product = "wasm-installable-svm"; # TODO: improve this test - installCheckPhase = '' + graalvmPhases.installCheckPhase = '' echo "Testing wasm" $out/bin/wasm --help '';