From ccbff74b884ea0e16c1a970017b9f4ad0c083ff9 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Mon, 13 Feb 2023 20:46:47 +0000 Subject: [PATCH 01/17] graalvmCEPackages.buildGraalvmProduct: inherit default meta from graalvm-ce --- .../graalvm/community-edition/buildGraalvmProduct.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix b/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix index e4b55cc756b7..5ec1b4062777 100644 --- a/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix +++ b/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix @@ -1,6 +1,7 @@ { lib , stdenv , autoPatchelfHook +, graalvm-ce , makeWrapper , perl , unzip @@ -64,10 +65,7 @@ stdenv.mkDerivation (args // { passthru = { inherit product; } // passthru; meta = with lib; ({ - homepage = "https://www.graalvm.org/"; + inherit (graalvm-ce.meta) homepage license sourceProvenance maintainers platforms; description = "High-Performance Polyglot VM (Product: ${product})"; - license = with licenses; [ upl gpl2Classpath bsd3 ]; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; - maintainers = with maintainers; teams.graalvm-ce.members ++ [ ]; } // meta); }) From c37428c7f35289e7b52092635777020ec6def81c Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Mon, 13 Feb 2023 20:59:33 +0000 Subject: [PATCH 02/17] graalvmCEPackages.python-installable-svm: init at 22.3.1 --- .../graalvm/community-edition/default.nix | 33 ++++++- .../graalvm/community-edition/hashes.nix | 94 +++++++++++++++++++ .../python-installable-svm.nix | 18 ++++ .../graalvm/community-edition/update.sh | 6 +- 4 files changed, 146 insertions(+), 5 deletions(-) create mode 100644 pkgs/development/compilers/graalvm/community-edition/python-installable-svm.nix diff --git a/pkgs/development/compilers/graalvm/community-edition/default.nix b/pkgs/development/compilers/graalvm/community-edition/default.nix index 0f9cec44f18f..d97269536b5f 100644 --- a/pkgs/development/compilers/graalvm/community-edition/default.nix +++ b/pkgs/development/compilers/graalvm/community-edition/default.nix @@ -6,7 +6,7 @@ }: let - buildGraalvm = callPackage ./buildGraalvm.nix { inherit Foundation; }; + buildGraalvm = lib.makeOverridable (callPackage ./buildGraalvm.nix { inherit Foundation; }); buildGraalvmProduct = callPackage ./buildGraalvmProduct.nix { }; javaPlatform = { "aarch64-linux" = "linux-aarch64"; @@ -16,7 +16,8 @@ let }; javaPlatformVersion = javaVersion: "${javaVersion}-${javaPlatform.${stdenv.system} or (throw "Unsupported platform: ${stdenv.system}")}"; - source = product: javaVersion: (import ./hashes.nix).${product}.${javaPlatformVersion javaVersion}; + source = product: javaVersion: (import ./hashes.nix).${product}.${javaPlatformVersion javaVersion} + or (throw "Unsupported product combination: product=${product} java=${javaVersion} system=${stdenv.system}"); in rec { @@ -30,6 +31,20 @@ rec { products = [ native-image-installable-svm-java11 ]; }; + # Mostly available for testing, do not expose in all-packages + graalvm11-ce-full = graalvm11-ce.override { + products = [ + native-image-installable-svm-java11 + python-installable-svm-java11 + ]; + }; + + python-installable-svm-java11 = callPackage ./python-installable-svm.nix rec { + javaVersion = "11"; + version = "22.3.1"; + src = fetchurl (source "python-installable-svm" javaVersion); + }; + native-image-installable-svm-java11 = callPackage ./native-image-installable-svm.nix rec { javaVersion = "11"; version = "22.3.1"; @@ -44,6 +59,20 @@ rec { products = [ native-image-installable-svm-java17 ]; }; + # Mostly available for testing, do not expose in all-packages + graalvm17-ce-full = graalvm17-ce.override { + products = [ + native-image-installable-svm-java17 + python-installable-svm-java17 + ]; + }; + + python-installable-svm-java17 = callPackage ./python-installable-svm.nix rec { + javaVersion = "17"; + version = "22.3.1"; + src = fetchurl (source "python-installable-svm" javaVersion); + }; + native-image-installable-svm-java17 = callPackage ./native-image-installable-svm.nix rec { javaVersion = "17"; version = "22.3.1"; diff --git a/pkgs/development/compilers/graalvm/community-edition/hashes.nix b/pkgs/development/compilers/graalvm/community-edition/hashes.nix index c0353e033ae2..4cfe5eedb773 100644 --- a/pkgs/development/compilers/graalvm/community-edition/hashes.nix +++ b/pkgs/development/compilers/graalvm/community-edition/hashes.nix @@ -1,5 +1,65 @@ # Generated by pkgs/development/compilers/graalvm/community-edition/update.sh script { + "wasm-installable-svm" = { + "11-linux-aarch64" = { + sha256 = "1d67jm41psypkhpy77cb2l00smhni3pgkybwx79z7dzcyid7p2l1"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java11-linux-aarch64-22.3.1.jar"; + }; + "17-linux-aarch64" = { + sha256 = "1cg9zxyjirfl0afr9cppg2h17j8qdidi4llbal2g5w1p2v9zq78b"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java17-linux-aarch64-22.3.1.jar"; + }; + "11-linux-amd64" = { + sha256 = "19v7jqhvijmzzb0i9q6hbvrmqnmmzbyvai3il9f357qvv6r6lylb"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java11-linux-amd64-22.3.1.jar"; + }; + "17-linux-amd64" = { + sha256 = "0sfnsy0r4qf7ni9mh437dad1d8sidajcra2azsmy5qdmh091zhj5"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java17-linux-amd64-22.3.1.jar"; + }; + "11-darwin-amd64" = { + sha256 = "0764d97mla5cii4iyvyb43v62dk8ff3plqjmdc69qqxx8mdzpwqv"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java11-darwin-amd64-22.3.1.jar"; + }; + "17-darwin-amd64" = { + sha256 = "1ip6ybm7p28bs2lifxqhq6fyvfm3wmacv6dqziyl2v7v7yl0iw4i"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java17-darwin-amd64-22.3.1.jar"; + }; + }; + "python-installable-svm" = { + "11-linux-aarch64" = { + sha256 = "1yl36x5svld7qnm3m6vmacm2n4d6l9vhdxhaypvlv2bbfbnym3c5"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java11-linux-aarch64-22.3.1.jar"; + }; + "17-linux-aarch64" = { + sha256 = "0ggx5rwz3qnnxgz407r8yx12556pcbirhnc44972l77r320rdmqc"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java17-linux-aarch64-22.3.1.jar"; + }; + "11-linux-amd64" = { + sha256 = "11c19a20v3ff83dxzs9hf1z89kh0qich41b03gx8mancf12jfwnl"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java11-linux-amd64-22.3.1.jar"; + }; + "17-linux-amd64" = { + sha256 = "0pga44whhvm98d8j2v2bpl9rkbvr9bv947rc4imlbf01cyxjwl71"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java17-linux-amd64-22.3.1.jar"; + }; + "11-darwin-aarch64" = { + sha256 = "0qnh8i9nazrv25jhn13wp7qqm9wwhcz4kpp2ygvsdmf9s3d2f5lf"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java11-darwin-aarch64-22.3.1.jar"; + }; + "17-darwin-aarch64" = { + sha256 = "0j13xvy9d19glipz4wdma2y02g0cnksg1iij4247fjhpqh0axkdz"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java17-darwin-aarch64-22.3.1.jar"; + }; + "11-darwin-amd64" = { + sha256 = "1ny5664h7pibvskmm51mlxrxkbbj2dvxsv2yqbq6v51a57wm1yzn"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java11-darwin-amd64-22.3.1.jar"; + }; + "17-darwin-amd64" = { + sha256 = "01jjncx8jm1yrps2nj217vgcmjaqclmpb27rdp3qn7k64w5wzipg"; + url = "https://github.com/graalvm/graalpython/releases/download/vm-22.3.1/python-installable-svm-java17-darwin-amd64-22.3.1.jar"; + }; + }; "native-image-installable-svm" = { "11-linux-aarch64" = { sha256 = "0z9rbmci6yz7f7mqd3xzsxc5ih4hq72lyzqfchan7fr6mh38d6gw"; @@ -68,4 +128,38 @@ url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java17-darwin-amd64-22.3.1.tar.gz"; }; }; + "ruby-installable-svm" = { + "11-linux-aarch64" = { + sha256 = "10wm1sq7smywy63mzlsbn21kzd65yaqj8yismpq8bz19h9skas7w"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java11-linux-aarch64-22.3.1.jar"; + }; + "17-linux-aarch64" = { + sha256 = "0kh1w49yp3kpfvhqw19bbx51ay1wgzq80gsrfqax4zm5ixz4wsbz"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java17-linux-aarch64-22.3.1.jar"; + }; + "11-linux-amd64" = { + sha256 = "0avsawgfkqbgqc2hm8zmz37qg9ag3ddni3my8g73kvzfkghsdabh"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java11-linux-amd64-22.3.1.jar"; + }; + "17-linux-amd64" = { + sha256 = "1ib00pqdhzl24y97j16mm86qwrijqjnmhjmk3g5vdhyhh099vjp1"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java17-linux-amd64-22.3.1.jar"; + }; + "11-darwin-aarch64" = { + sha256 = "1im75qad89xa2nbl80csnwn56k6n11zv5g91xlkqq4xk300v1saj"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java11-darwin-aarch64-22.3.1.jar"; + }; + "17-darwin-aarch64" = { + sha256 = "1pfzsisf4sgzxmk3r1p4apzqkwipjpf8naly3v94i5v3b5gbnczx"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java17-darwin-aarch64-22.3.1.jar"; + }; + "11-darwin-amd64" = { + sha256 = "1jfls71y92hw09s869v2qw8pypgl1fciqz3m9zcd2602hikysq6c"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java11-darwin-amd64-22.3.1.jar"; + }; + "17-darwin-amd64" = { + sha256 = "03x2h4sw72l05xxg73xj9mzzkxffbjpv8hdi59rgxxljnz0ai6rx"; + url = "https://github.com/oracle/truffleruby/releases/download/vm-22.3.1/ruby-installable-svm-java17-darwin-amd64-22.3.1.jar"; + }; + }; } diff --git a/pkgs/development/compilers/graalvm/community-edition/python-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/python-installable-svm.nix new file mode 100644 index 000000000000..50821f79efc4 --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/python-installable-svm.nix @@ -0,0 +1,18 @@ +{ lib +, stdenv +, graalvmCEPackages +, javaVersion +, src +, version +}: + +graalvmCEPackages.buildGraalvmProduct rec { + inherit src javaVersion version; + product = "python-installable-svm"; + + 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/update.sh b/pkgs/development/compilers/graalvm/community-edition/update.sh index 476bd754ad50..ff16f2741a3d 100755 --- a/pkgs/development/compilers/graalvm/community-edition/update.sh +++ b/pkgs/development/compilers/graalvm/community-edition/update.sh @@ -40,9 +40,9 @@ fi declare -r -A products_urls=( [graalvm-ce]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/graalvm-ce-java@platform@-${new_version}.tar.gz" [native-image-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/native-image-installable-svm-java@platform@-${new_version}.jar" - # [ruby-installable-svm]="https://github.com/oracle/truffleruby/releases/download/vm-${new_version}/ruby-installable-svm-java@platform@-${new_version}.jar" - # [wasm-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/wasm-installable-svm-java@platform@-${new_version}.jar" - # [python-installable-svm]="https://github.com/graalvm/graalpython/releases/download/vm-${new_version}/python-installable-svm-java@platform@-${new_version}.jar" + [ruby-installable-svm]="https://github.com/oracle/truffleruby/releases/download/vm-${new_version}/ruby-installable-svm-java@platform@-${new_version}.jar" + [wasm-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/wasm-installable-svm-java@platform@-${new_version}.jar" + [python-installable-svm]="https://github.com/graalvm/graalpython/releases/download/vm-${new_version}/python-installable-svm-java@platform@-${new_version}.jar" ) readonly platforms=( From e17f76f94f2fd9460bbf33eb072a0e0e7d807f4c Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Mon, 13 Feb 2023 21:19:42 +0000 Subject: [PATCH 03/17] graalvmCEPackages.wasm-installable-svm: init at 22.3.1 --- .../community-edition/buildGraalvm.nix | 3 +++ .../graalvm/community-edition/default.nix | 14 ++++++++++++ .../wasm-installable-svm.nix | 22 +++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 pkgs/development/compilers/graalvm/community-edition/wasm-installable-svm.nix diff --git a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix index f8a1e515db3b..0abc92f6ed25 100644 --- a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix @@ -109,6 +109,9 @@ let installCheckPhase = '' runHook preInstallCheck + echo "Testing Jshell" + echo '1 + 1' | $out/bin/jshell + echo ${ lib.escapeShellArg '' public class HelloWorld { diff --git a/pkgs/development/compilers/graalvm/community-edition/default.nix b/pkgs/development/compilers/graalvm/community-edition/default.nix index d97269536b5f..4008b0b925ba 100644 --- a/pkgs/development/compilers/graalvm/community-edition/default.nix +++ b/pkgs/development/compilers/graalvm/community-edition/default.nix @@ -36,6 +36,7 @@ rec { products = [ native-image-installable-svm-java11 python-installable-svm-java11 + wasm-installable-svm-java11 ]; }; @@ -51,6 +52,12 @@ rec { src = fetchurl (source "native-image-installable-svm" javaVersion); }; + wasm-installable-svm-java11 = callPackage ./wasm-installable-svm.nix rec { + javaVersion = "11"; + version = "22.3.1"; + src = fetchurl (source "wasm-installable-svm" javaVersion); + }; + graalvm17-ce = buildGraalvm rec { version = "22.3.1"; javaVersion = "17"; @@ -64,6 +71,7 @@ rec { products = [ native-image-installable-svm-java17 python-installable-svm-java17 + wasm-installable-svm-java17 ]; }; @@ -78,4 +86,10 @@ rec { version = "22.3.1"; src = fetchurl (source "native-image-installable-svm" javaVersion); }; + + wasm-installable-svm-java17 = callPackage ./wasm-installable-svm.nix rec { + javaVersion = "17"; + version = "22.3.1"; + src = fetchurl (source "wasm-installable-svm" javaVersion); + }; } diff --git a/pkgs/development/compilers/graalvm/community-edition/wasm-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/wasm-installable-svm.nix new file mode 100644 index 000000000000..6cf6cdb1d6ed --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/wasm-installable-svm.nix @@ -0,0 +1,22 @@ +{ lib +, stdenv +, graalvm-ce +, graalvmCEPackages +, javaVersion +, src +, version +}: + +graalvmCEPackages.buildGraalvmProduct rec { + inherit src javaVersion version; + product = "wasm-installable-svm"; + + # TODO: improve this test + installCheckPhase = '' + echo "Testing wasm" + $out/bin/wasm --help + ''; + + # Not supported in aarch64-darwin yet as GraalVM 22.3.1 release + meta.platforms = builtins.filter (p: p != "aarch64-darwin") graalvm-ce.meta.platforms; +} From 171730f0f744675b14fdc3109f0bb2dd92b59dde Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Mon, 13 Feb 2023 23:06:35 +0000 Subject: [PATCH 04/17] graalvmCEProducts.buildGraalvmProduct: make it overridable --- .../compilers/graalvm/community-edition/buildGraalvm.nix | 1 - .../development/compilers/graalvm/community-edition/default.nix | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix index 0abc92f6ed25..3a72aa72cd72 100644 --- a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix @@ -139,7 +139,6 @@ let }; meta = with lib; ({ - inherit platforms; homepage = "https://www.graalvm.org/"; description = "High-Performance Polyglot VM"; license = with licenses; [ upl gpl2Classpath bsd3 ]; diff --git a/pkgs/development/compilers/graalvm/community-edition/default.nix b/pkgs/development/compilers/graalvm/community-edition/default.nix index 4008b0b925ba..49d54ab33f87 100644 --- a/pkgs/development/compilers/graalvm/community-edition/default.nix +++ b/pkgs/development/compilers/graalvm/community-edition/default.nix @@ -7,7 +7,7 @@ let buildGraalvm = lib.makeOverridable (callPackage ./buildGraalvm.nix { inherit Foundation; }); - buildGraalvmProduct = callPackage ./buildGraalvmProduct.nix { }; + buildGraalvmProduct = lib.makeOverridable (callPackage ./buildGraalvmProduct.nix { }); javaPlatform = { "aarch64-linux" = "linux-aarch64"; "x86_64-linux" = "linux-amd64"; From 4f150675badaeaaf2aa9e2c49ff37a69e52b9c72 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 14 Feb 2023 15:17:12 +0000 Subject: [PATCH 05/17] graalvm*-ce: make update.sh script re-use cache --- .../graalvm/community-edition/update.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pkgs/development/compilers/graalvm/community-edition/update.sh b/pkgs/development/compilers/graalvm/community-edition/update.sh index ff16f2741a3d..575fbbf493cf 100755 --- a/pkgs/development/compilers/graalvm/community-edition/update.sh +++ b/pkgs/development/compilers/graalvm/community-edition/update.sh @@ -14,9 +14,10 @@ verlte() { [ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ] } +readonly hashes_nix="hashes.nix" readonly nixpkgs=../../../../.. -readonly current_version="$(nix-instantiate "$nixpkgs" --eval --strict -A graalvm-ce.version | tr -d \")" +readonly current_version="$(nix-instantiate "$nixpkgs" --eval --strict -A graalvm-ce.version --json | jq -r)" if [[ -z "${1:-}" ]]; then readonly gh_version="$(curl \ @@ -40,9 +41,9 @@ fi declare -r -A products_urls=( [graalvm-ce]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/graalvm-ce-java@platform@-${new_version}.tar.gz" [native-image-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/native-image-installable-svm-java@platform@-${new_version}.jar" + [python-installable-svm]="https://github.com/graalvm/graalpython/releases/download/vm-${new_version}/python-installable-svm-java@platform@-${new_version}.jar" [ruby-installable-svm]="https://github.com/oracle/truffleruby/releases/download/vm-${new_version}/ruby-installable-svm-java@platform@-${new_version}.jar" [wasm-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/wasm-installable-svm-java@platform@-${new_version}.jar" - [python-installable-svm]="https://github.com/graalvm/graalpython/releases/download/vm-${new_version}/python-installable-svm-java@platform@-${new_version}.jar" ) readonly platforms=( @@ -65,11 +66,20 @@ for product in "${!products_urls[@]}"; do url="${products_urls["${product}"]}" echo_file " \"$product\" = {" for platform in "${platforms[@]}"; do - if hash="$(nix-prefetch-url "${url//@platform@/$platform}")"; then + # Reuse cache as long the version is the same + if [[ "$current_version" == "$new_version" ]]; then + previous_hash="$(nix-instantiate --eval "$hashes_nix" -A "$product.$platform.sha256" --json | jq -r || true)" + else + previous_hash="" + fi + # Lack of quoting in $previous_hash is proposital + if hash="$(nix-prefetch-url "${url//@platform@/$platform}" $previous_hash)"; then echo_file " \"$platform\" = {" echo_file " sha256 = \"$hash\";" echo_file " url = \"${url//@platform@/${platform}}\";" echo_file " };" + else + info "Error while downloading '$product' for '$platform'. Skipping it..." fi done echo_file " };" @@ -81,6 +91,6 @@ info "Updating graalvm-ce version..." sed "s|$current_version|$new_version|" -i default.nix info "Moving the temporary file to hashes.nix" -mv "$tmpfile" hashes.nix +mv "$tmpfile" "$hashes_nix" info "Done!" From 365ff22467cf1a43ed36f9c5aac6851840b6e84b Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 14 Feb 2023 15:23:26 +0000 Subject: [PATCH 06/17] graalvmCEPackages.llvm-installable-svm: init at 22.3.1 --- .../graalvm/community-edition/default.nix | 22 +++++++++--- .../graalvm/community-edition/hashes.nix | 34 +++++++++++++++++++ .../llvm-installable-svm.nix | 22 ++++++++++++ .../ruby-installable-svm.nix | 30 ++++++++++++++++ .../graalvm/community-edition/update.sh | 1 + 5 files changed, 105 insertions(+), 4 deletions(-) create mode 100644 pkgs/development/compilers/graalvm/community-edition/llvm-installable-svm.nix create mode 100644 pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix diff --git a/pkgs/development/compilers/graalvm/community-edition/default.nix b/pkgs/development/compilers/graalvm/community-edition/default.nix index 49d54ab33f87..616e73554748 100644 --- a/pkgs/development/compilers/graalvm/community-edition/default.nix +++ b/pkgs/development/compilers/graalvm/community-edition/default.nix @@ -34,16 +34,17 @@ rec { # Mostly available for testing, do not expose in all-packages graalvm11-ce-full = graalvm11-ce.override { products = [ + llvm-installable-svm-java17 native-image-installable-svm-java11 python-installable-svm-java11 wasm-installable-svm-java11 ]; }; - python-installable-svm-java11 = callPackage ./python-installable-svm.nix rec { + llvm-installable-svm-java11 = callPackage ./llvm-installable-svm.nix rec { javaVersion = "11"; version = "22.3.1"; - src = fetchurl (source "python-installable-svm" javaVersion); + src = fetchurl (source "llvm-installable-svm" javaVersion); }; native-image-installable-svm-java11 = callPackage ./native-image-installable-svm.nix rec { @@ -52,6 +53,12 @@ rec { src = fetchurl (source "native-image-installable-svm" javaVersion); }; + python-installable-svm-java11 = callPackage ./python-installable-svm.nix rec { + javaVersion = "11"; + version = "22.3.1"; + src = fetchurl (source "python-installable-svm" javaVersion); + }; + wasm-installable-svm-java11 = callPackage ./wasm-installable-svm.nix rec { javaVersion = "11"; version = "22.3.1"; @@ -69,16 +76,17 @@ rec { # Mostly available for testing, do not expose in all-packages graalvm17-ce-full = graalvm17-ce.override { products = [ + llvm-installable-svm-java17 native-image-installable-svm-java17 python-installable-svm-java17 wasm-installable-svm-java17 ]; }; - python-installable-svm-java17 = callPackage ./python-installable-svm.nix rec { + llvm-installable-svm-java17 = callPackage ./llvm-installable-svm.nix rec { javaVersion = "17"; version = "22.3.1"; - src = fetchurl (source "python-installable-svm" javaVersion); + src = fetchurl (source "llvm-installable-svm" javaVersion); }; native-image-installable-svm-java17 = callPackage ./native-image-installable-svm.nix rec { @@ -87,6 +95,12 @@ rec { src = fetchurl (source "native-image-installable-svm" javaVersion); }; + python-installable-svm-java17 = callPackage ./python-installable-svm.nix rec { + javaVersion = "17"; + version = "22.3.1"; + src = fetchurl (source "python-installable-svm" javaVersion); + }; + wasm-installable-svm-java17 = callPackage ./wasm-installable-svm.nix rec { javaVersion = "17"; version = "22.3.1"; diff --git a/pkgs/development/compilers/graalvm/community-edition/hashes.nix b/pkgs/development/compilers/graalvm/community-edition/hashes.nix index 4cfe5eedb773..0970ffadee4d 100644 --- a/pkgs/development/compilers/graalvm/community-edition/hashes.nix +++ b/pkgs/development/compilers/graalvm/community-edition/hashes.nix @@ -1,5 +1,39 @@ # Generated by pkgs/development/compilers/graalvm/community-edition/update.sh script { + "llvm-installable-svm" = { + "11-linux-aarch64" = { + sha256 = "0h8xkvsixcwak5dymkj3jgjv11w3ivnd6d45v5pdbymd0m2ifia8"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java11-linux-aarch64-22.3.1.jar"; + }; + "17-linux-aarch64" = { + sha256 = "1zww45z7m3mvzg47fwc3jgqz3hkra220isf4ih8sv6kjg1jc4y14"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java17-linux-aarch64-22.3.1.jar"; + }; + "11-linux-amd64" = { + sha256 = "133m9vg9rlp2xkndh3d6b8ybq8vwch99rj1b50xr6bz8r6306ara"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java11-linux-amd64-22.3.1.jar"; + }; + "17-linux-amd64" = { + sha256 = "0nz09idp8wawm3yinsplzvxhld8yav06l1nqj02gxrc1kxd5nsr1"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java17-linux-amd64-22.3.1.jar"; + }; + "11-darwin-aarch64" = { + sha256 = "0ngcm3ara7g1xz4kh515igpyrjhr1k5z9nf4vsaw4lpa5sqljv7z"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java11-darwin-aarch64-22.3.1.jar"; + }; + "17-darwin-aarch64" = { + sha256 = "1lr8kk82c3l9hx7wc5hqmpqfgvpk72xg1h07b6cgibry1bm6baj6"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java17-darwin-aarch64-22.3.1.jar"; + }; + "11-darwin-amd64" = { + sha256 = "058pzrd90xx4yi7mm2fvs2npqcdkb2nzhqfwfz5v202038igi61g"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java11-darwin-amd64-22.3.1.jar"; + }; + "17-darwin-amd64" = { + sha256 = "10rfz8ddq82zpf6cy2y0gx1bx0zhjzm3gwwdb1j7mll0hvwp84sg"; + url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/llvm-installable-svm-java17-darwin-amd64-22.3.1.jar"; + }; + }; "wasm-installable-svm" = { "11-linux-aarch64" = { sha256 = "1d67jm41psypkhpy77cb2l00smhni3pgkybwx79z7dzcyid7p2l1"; diff --git a/pkgs/development/compilers/graalvm/community-edition/llvm-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/llvm-installable-svm.nix new file mode 100644 index 000000000000..7c2fc8e49916 --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/llvm-installable-svm.nix @@ -0,0 +1,22 @@ +{ lib +, stdenv +, graalvmCEPackages +, javaVersion +, src +, version +}: + +graalvmCEPackages.buildGraalvmProduct rec { + inherit src javaVersion version; + product = "llvm-installable-svm"; + + preFixup = '' + ln -s $out/languages/llvm/native/lib/*.so $out/lib + ''; + + # TODO: improve this test + installCheckPhase = '' + echo "Testing llvm" + $out/bin/lli --help + ''; +} diff --git a/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix new file mode 100644 index 000000000000..50ee59927bf6 --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix @@ -0,0 +1,30 @@ +{ lib +, stdenv +, graalvmCEPackages +, openssl +, javaVersion +, musl +, src +, version +}: + +graalvmCEPackages.buildGraalvmProduct rec { + inherit src javaVersion version; + product = "ruby-installable-svm"; + + extraBuildInputs = [ openssl ]; + + preFixup = '' + patchelf $out/languages/ruby/lib/mri/openssl.so \ + --replace-needed libssl.so.10 libssl.so \ + --replace-needed libcrypto.so.10 libcrypto.so + ''; + + installCheckPhase = '' + echo "Testing TruffleRuby" + # Hide warnings about wrong locale + export LANG=C + export LC_ALL=C + $out/bin/ruby -e 'puts(1 + 1)' + ''; +} diff --git a/pkgs/development/compilers/graalvm/community-edition/update.sh b/pkgs/development/compilers/graalvm/community-edition/update.sh index 575fbbf493cf..7bb95010512e 100755 --- a/pkgs/development/compilers/graalvm/community-edition/update.sh +++ b/pkgs/development/compilers/graalvm/community-edition/update.sh @@ -40,6 +40,7 @@ fi declare -r -A products_urls=( [graalvm-ce]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/graalvm-ce-java@platform@-${new_version}.tar.gz" + [llvm-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/llvm-installable-svm-java@platform@-${new_version}.jar" [native-image-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/native-image-installable-svm-java@platform@-${new_version}.jar" [python-installable-svm]="https://github.com/graalvm/graalpython/releases/download/vm-${new_version}/python-installable-svm-java@platform@-${new_version}.jar" [ruby-installable-svm]="https://github.com/oracle/truffleruby/releases/download/vm-${new_version}/ruby-installable-svm-java@platform@-${new_version}.jar" From 140046c4225a8bc349a1e9241f3666b739d5b5b7 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 14 Feb 2023 15:46:39 +0000 Subject: [PATCH 07/17] graalvmCEPackages.ruby-installable-svm: init at 22.3.1 --- .../graalvm/community-edition/default.nix | 16 ++++++++++++++++ .../community-edition/llvm-installable-svm.nix | 2 +- .../community-edition/ruby-installable-svm.nix | 7 ++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/graalvm/community-edition/default.nix b/pkgs/development/compilers/graalvm/community-edition/default.nix index 616e73554748..1de27fc0d50b 100644 --- a/pkgs/development/compilers/graalvm/community-edition/default.nix +++ b/pkgs/development/compilers/graalvm/community-edition/default.nix @@ -37,6 +37,7 @@ rec { llvm-installable-svm-java17 native-image-installable-svm-java11 python-installable-svm-java11 + ruby-installable-svm-java11 wasm-installable-svm-java11 ]; }; @@ -59,6 +60,13 @@ rec { src = fetchurl (source "python-installable-svm" javaVersion); }; + ruby-installable-svm-java11 = callPackage ./ruby-installable-svm.nix rec { + javaVersion = "11"; + version = "22.3.1"; + src = fetchurl (source "ruby-installable-svm" javaVersion); + llvm-installable-svm = llvm-installable-svm-java11; + }; + wasm-installable-svm-java11 = callPackage ./wasm-installable-svm.nix rec { javaVersion = "11"; version = "22.3.1"; @@ -79,6 +87,7 @@ rec { llvm-installable-svm-java17 native-image-installable-svm-java17 python-installable-svm-java17 + ruby-installable-svm-java17 wasm-installable-svm-java17 ]; }; @@ -101,6 +110,13 @@ rec { src = fetchurl (source "python-installable-svm" javaVersion); }; + ruby-installable-svm-java17 = callPackage ./ruby-installable-svm.nix rec { + javaVersion = "17"; + version = "22.3.1"; + src = fetchurl (source "ruby-installable-svm" javaVersion); + llvm-installable-svm = llvm-installable-svm-java17; + }; + wasm-installable-svm-java17 = callPackage ./wasm-installable-svm.nix rec { javaVersion = "17"; version = "22.3.1"; 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 7c2fc8e49916..c831d8119877 100644 --- a/pkgs/development/compilers/graalvm/community-edition/llvm-installable-svm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/llvm-installable-svm.nix @@ -10,7 +10,7 @@ graalvmCEPackages.buildGraalvmProduct rec { inherit src javaVersion version; product = "llvm-installable-svm"; - preFixup = '' + postUnpack = '' ln -s $out/languages/llvm/native/lib/*.so $out/lib ''; 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 50ee59927bf6..4d00ef43c685 100644 --- a/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix @@ -6,13 +6,17 @@ , musl , src , version +, llvm-installable-svm }: graalvmCEPackages.buildGraalvmProduct rec { inherit src javaVersion version; product = "ruby-installable-svm"; - extraBuildInputs = [ openssl ]; + extraBuildInputs = [ + llvm-installable-svm + openssl + ]; preFixup = '' patchelf $out/languages/ruby/lib/mri/openssl.so \ @@ -26,5 +30,6 @@ graalvmCEPackages.buildGraalvmProduct rec { export LANG=C export LC_ALL=C $out/bin/ruby -e 'puts(1 + 1)' + echo '1 + 1' | $out/bin/irb ''; } From acf85793075f03d54d6639abc3dd02503f7c8499 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 14 Feb 2023 16:01:43 +0000 Subject: [PATCH 08/17] graalvmCEPackages.buildGraalvmProduct: add passthru.graalvmPhases This way it is easier to differentiate between phases running in the `buildGraalvmProduct` and `buildGraalvm`. --- .../community-edition/buildGraalvm.nix | 6 ++-- .../community-edition/buildGraalvmProduct.nix | 30 +++++++++++++------ .../llvm-installable-svm.nix | 2 +- .../native-image-installable-svm.nix | 4 +-- .../python-installable-svm.nix | 2 +- .../ruby-installable-svm.nix | 2 +- .../wasm-installable-svm.nix | 2 +- 7 files changed, 30 insertions(+), 18 deletions(-) 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 ''; From c9d481f3caa646e1131e254dd8ad8919c17b7611 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 14 Feb 2023 16:32:49 +0000 Subject: [PATCH 09/17] graalvm*-ce-full: improve comment about it --- .../compilers/graalvm/community-edition/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/graalvm/community-edition/default.nix b/pkgs/development/compilers/graalvm/community-edition/default.nix index 1de27fc0d50b..7956b701893e 100644 --- a/pkgs/development/compilers/graalvm/community-edition/default.nix +++ b/pkgs/development/compilers/graalvm/community-edition/default.nix @@ -31,7 +31,7 @@ rec { products = [ native-image-installable-svm-java11 ]; }; - # Mostly available for testing, do not expose in all-packages + # Mostly available for testing, not to be exposed at the top level graalvm11-ce-full = graalvm11-ce.override { products = [ llvm-installable-svm-java17 @@ -81,7 +81,7 @@ rec { products = [ native-image-installable-svm-java17 ]; }; - # Mostly available for testing, do not expose in all-packages + # Mostly available for testing, not to be exposed at the top level graalvm17-ce-full = graalvm17-ce.override { products = [ llvm-installable-svm-java17 From 3e5d655f0f3305dfac6d397734fcfd74e5482573 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 14 Feb 2023 16:43:06 +0000 Subject: [PATCH 10/17] graalvmCEPackages.graalvm11-ce-full: fix llvm-installable-svm version --- .../development/compilers/graalvm/community-edition/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/graalvm/community-edition/default.nix b/pkgs/development/compilers/graalvm/community-edition/default.nix index 7956b701893e..0654dc89c20a 100644 --- a/pkgs/development/compilers/graalvm/community-edition/default.nix +++ b/pkgs/development/compilers/graalvm/community-edition/default.nix @@ -34,7 +34,7 @@ rec { # Mostly available for testing, not to be exposed at the top level graalvm11-ce-full = graalvm11-ce.override { products = [ - llvm-installable-svm-java17 + llvm-installable-svm-java11 native-image-installable-svm-java11 python-installable-svm-java11 ruby-installable-svm-java11 From a065de41acc840cbb2931a68f1177d8b6eddc2f0 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 14 Feb 2023 16:44:24 +0000 Subject: [PATCH 11/17] graalvmCEPackages.ruby-installable-svm: update comment about locale --- .../graalvm/community-edition/ruby-installable-svm.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e7f8f157db9e..381c895c2b3a 100644 --- a/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix @@ -26,7 +26,7 @@ graalvmCEPackages.buildGraalvmProduct rec { graalvmPhases.installCheckPhase = '' echo "Testing TruffleRuby" - # Hide warnings about wrong locale + # Fixup/silence warnings about wrong locale export LANG=C export LC_ALL=C $out/bin/ruby -e 'puts(1 + 1)' From eaa3e39cc0e870e38d9d2ac6d105458b4df45830 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 14 Feb 2023 16:53:34 +0000 Subject: [PATCH 12/17] graalvmCEPackages.ruby-installable-svm: run patchelf only in Linux --- .../graalvm/community-edition/ruby-installable-svm.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 381c895c2b3a..a9cc5d92257b 100644 --- a/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix @@ -18,7 +18,7 @@ graalvmCEPackages.buildGraalvmProduct rec { openssl ]; - preFixup = '' + preFixup = lib.optionalString stdenv.isLinux '' patchelf $out/languages/ruby/lib/mri/openssl.so \ --replace-needed libssl.so.10 libssl.so \ --replace-needed libcrypto.so.10 libcrypto.so From 820eb1cc8dfed101fd25c81f8aef9bf68210da79 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 14 Feb 2023 17:00:01 +0000 Subject: [PATCH 13/17] graalvmCEPackages.buildGraalvm: disable test in Darwin --- .../compilers/graalvm/community-edition/buildGraalvm.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix index a3dc2691830a..a7d824f87972 100644 --- a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix @@ -109,8 +109,11 @@ let installCheckPhase = '' runHook preInstallCheck - echo "Testing Jshell" - echo '1 + 1' | $out/bin/jshell + ${# broken in darwin + lib.optionalString stdenv.isLinux '' + echo "Testing Jshell" + echo '1 + 1' | $out/bin/jshell + ''} echo ${ lib.escapeShellArg '' From 248449fbdf50e60cc38a52c243e3d68bb3efcb66 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 14 Feb 2023 17:00:45 +0000 Subject: [PATCH 14/17] graalvmCEPackages: formatting --- .../compilers/graalvm/community-edition/buildGraalvm.nix | 6 ++++-- .../graalvm/community-edition/buildGraalvmProduct.nix | 3 ++- .../community-edition/native-image-installable-svm.nix | 6 ++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix index a7d824f87972..3111fea1b400 100644 --- a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix @@ -18,7 +18,8 @@ { javaVersion , meta ? { } , products ? [ ] -, ... } @ args: +, ... +} @ args: let runtimeLibraryPath = lib.makeLibraryPath @@ -150,4 +151,5 @@ let maintainers = with maintainers; teams.graalvm-ce.members ++ [ ]; } // meta); } // (builtins.removeAttrs args [ "javaVersion" "meta" "products" ])); -in graalvmXXX-ce +in +graalvmXXX-ce diff --git a/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix b/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix index de1f75249e47..52cf6e7e89e9 100644 --- a/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix +++ b/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix @@ -14,7 +14,8 @@ , graalvmPhases ? { } , meta ? { } , passthru ? { } -, ... } @ args: +, ... +} @ args: stdenv.mkDerivation ({ pname = "${product}-java${javaVersion}"; 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 6d1c58d4b114..427c5ffef5b5 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 @@ -39,7 +39,8 @@ graalvmCEPackages.buildGraalvmProduct rec { $out/bin/native-image -H:-CheckToolchain -H:+ReportExceptionStackTraces HelloWorld ./helloworld | fgrep 'Hello World' - ${lib.optionalString (stdenv.isLinux && !useMusl) '' + ${# --static is only available in Linux + lib.optionalString (stdenv.isLinux && !useMusl) '' echo "Ahead-Of-Time compilation with -H:+StaticExecutableWithDynamicLibC" $out/bin/native-image -H:+StaticExecutableWithDynamicLibC HelloWorld ./helloworld | fgrep 'Hello World' @@ -49,7 +50,8 @@ graalvmCEPackages.buildGraalvmProduct rec { ./helloworld | fgrep 'Hello World' ''} - ${lib.optionalString (stdenv.isLinux && useMusl) '' + ${# --static is only available in Linux + lib.optionalString (stdenv.isLinux && useMusl) '' echo "Ahead-Of-Time compilation with --static and --libc=musl" $out/bin/native-image --static HelloWorld --libc=musl ./helloworld | fgrep 'Hello World' From 19e4e0a5e9465de8a60e7b62a37fa97d2dc06087 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 14 Feb 2023 17:19:52 +0000 Subject: [PATCH 15/17] graalvmCEPackages.graaljs: init at 22.3.1 --- .../graalvm/community-edition/default.nix | 14 ++++++++ .../graalvm/community-edition/hashes.nix | 34 +++++++++++++++++++ .../community-edition/js-installable-svm.nix | 18 ++++++++++ .../graalvm/community-edition/update.sh | 1 + 4 files changed, 67 insertions(+) create mode 100644 pkgs/development/compilers/graalvm/community-edition/js-installable-svm.nix diff --git a/pkgs/development/compilers/graalvm/community-edition/default.nix b/pkgs/development/compilers/graalvm/community-edition/default.nix index 0654dc89c20a..afc0456c9746 100644 --- a/pkgs/development/compilers/graalvm/community-edition/default.nix +++ b/pkgs/development/compilers/graalvm/community-edition/default.nix @@ -34,6 +34,7 @@ rec { # Mostly available for testing, not to be exposed at the top level graalvm11-ce-full = graalvm11-ce.override { products = [ + js-installable-svm-java11 llvm-installable-svm-java11 native-image-installable-svm-java11 python-installable-svm-java11 @@ -42,6 +43,12 @@ rec { ]; }; + js-installable-svm-java11 = callPackage ./js-installable-svm.nix rec { + javaVersion = "11"; + version = "22.3.1"; + src = fetchurl (source "js-installable-svm" javaVersion); + }; + llvm-installable-svm-java11 = callPackage ./llvm-installable-svm.nix rec { javaVersion = "11"; version = "22.3.1"; @@ -84,6 +91,7 @@ rec { # Mostly available for testing, not to be exposed at the top level graalvm17-ce-full = graalvm17-ce.override { products = [ + js-installable-svm-java17 llvm-installable-svm-java17 native-image-installable-svm-java17 python-installable-svm-java17 @@ -92,6 +100,12 @@ rec { ]; }; + js-installable-svm-java17 = callPackage ./js-installable-svm.nix rec { + javaVersion = "17"; + version = "22.3.1"; + src = fetchurl (source "js-installable-svm" javaVersion); + }; + llvm-installable-svm-java17 = callPackage ./llvm-installable-svm.nix rec { javaVersion = "17"; version = "22.3.1"; diff --git a/pkgs/development/compilers/graalvm/community-edition/hashes.nix b/pkgs/development/compilers/graalvm/community-edition/hashes.nix index 0970ffadee4d..c67702db82b9 100644 --- a/pkgs/development/compilers/graalvm/community-edition/hashes.nix +++ b/pkgs/development/compilers/graalvm/community-edition/hashes.nix @@ -60,6 +60,40 @@ url = "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/wasm-installable-svm-java17-darwin-amd64-22.3.1.jar"; }; }; + "js-installable-svm" = { + "11-linux-aarch64" = { + sha256 = "1b8vnjjsa548c6j3dycxp57i9xmyvndiz2xhv7fm10izcplyspxq"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java11-linux-aarch64-22.3.1.jar"; + }; + "17-linux-aarch64" = { + sha256 = "1kcy3mjk908zs7f3k95awp6294cwr06hand4cbw1lsnfvp0qwhk7"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java17-linux-aarch64-22.3.1.jar"; + }; + "11-linux-amd64" = { + sha256 = "0sq80a4nnvik560whgv5vwlsszi8z02idvpd92p0caf03bra9x2b"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java11-linux-amd64-22.3.1.jar"; + }; + "17-linux-amd64" = { + sha256 = "0fd160yxsi09m97z7vqh5kwf1g0p0hn4niy48glj9jhirfqzzw0c"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java17-linux-amd64-22.3.1.jar"; + }; + "11-darwin-aarch64" = { + sha256 = "18g0xixzk45yrxv3zfs7qrdyj0b3ksp59jhbcis0vwy9gx8094wq"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java11-darwin-aarch64-22.3.1.jar"; + }; + "17-darwin-aarch64" = { + sha256 = "0cf4iivkniilvbqyniqxcz1qf49cs4lxi0axjsk9sz1zmxcq0bnk"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java17-darwin-aarch64-22.3.1.jar"; + }; + "11-darwin-amd64" = { + sha256 = "0ibcz6ivx068ndf45j9pghm8qwq287glqxf0xx08kjxnhms67p52"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java11-darwin-amd64-22.3.1.jar"; + }; + "17-darwin-amd64" = { + sha256 = "16q7whnvdrk8lb4fp96qr3p567kggyk9q5iqcn081qk8xjkbx0zv"; + url = "https://github.com/graalvm/graaljs/releases/download/vm-22.3.1/js-installable-svm-java17-darwin-amd64-22.3.1.jar"; + }; + }; "python-installable-svm" = { "11-linux-aarch64" = { sha256 = "1yl36x5svld7qnm3m6vmacm2n4d6l9vhdxhaypvlv2bbfbnym3c5"; diff --git a/pkgs/development/compilers/graalvm/community-edition/js-installable-svm.nix b/pkgs/development/compilers/graalvm/community-edition/js-installable-svm.nix new file mode 100644 index 000000000000..0ab20c0e1dfe --- /dev/null +++ b/pkgs/development/compilers/graalvm/community-edition/js-installable-svm.nix @@ -0,0 +1,18 @@ +{ lib +, stdenv +, graalvm-ce +, graalvmCEPackages +, javaVersion +, src +, version +}: + +graalvmCEPackages.buildGraalvmProduct rec { + inherit src javaVersion version; + product = "js-installable-svm"; + + graalvmPhases.installCheckPhase = '' + echo "Testing GraalJS" + echo '1 + 1' | $out/bin/js + ''; +} diff --git a/pkgs/development/compilers/graalvm/community-edition/update.sh b/pkgs/development/compilers/graalvm/community-edition/update.sh index 7bb95010512e..fb1036cf8870 100755 --- a/pkgs/development/compilers/graalvm/community-edition/update.sh +++ b/pkgs/development/compilers/graalvm/community-edition/update.sh @@ -40,6 +40,7 @@ fi declare -r -A products_urls=( [graalvm-ce]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/graalvm-ce-java@platform@-${new_version}.tar.gz" + [js-installable-svm]="https://github.com/graalvm/graaljs/releases/download/vm-${new_version}/js-installable-svm-java@platform@-${new_version}.jar" [llvm-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/llvm-installable-svm-java@platform@-${new_version}.jar" [native-image-installable-svm]="https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-${new_version}/native-image-installable-svm-java@platform@-${new_version}.jar" [python-installable-svm]="https://github.com/graalvm/graalpython/releases/download/vm-${new_version}/python-installable-svm-java@platform@-${new_version}.jar" From 3926d8c482fcb577f22e2c68ed36d537fb6a927c Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 14 Feb 2023 17:53:57 +0000 Subject: [PATCH 16/17] graalvmCEPackages.ruby-installable-svm: disable broken test in darwin --- .../graalvm/community-edition/ruby-installable-svm.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 a9cc5d92257b..a5c8f718b278 100644 --- a/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/ruby-installable-svm.nix @@ -30,6 +30,9 @@ graalvmCEPackages.buildGraalvmProduct rec { export LANG=C export LC_ALL=C $out/bin/ruby -e 'puts(1 + 1)' - echo '1 + 1' | $out/bin/irb + ${# broken in darwin with sandbox enabled + lib.optionalString stdenv.isLinux '' + echo '1 + 1' | $out/bin/irb + ''} ''; } From cce466a5827333c67a5a9ae4c2929e7ce1c0050b Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Tue, 14 Feb 2023 19:04:12 +0000 Subject: [PATCH 17/17] graalvm*-ce: allow all parameters to be overriden --- .../community-edition/buildGraalvm.nix | 33 +++++++++++++++---- .../community-edition/buildGraalvmProduct.nix | 33 ++++++++++++------- .../graalvm/community-edition/default.nix | 5 ++- pkgs/top-level/all-packages.nix | 4 +-- 4 files changed, 52 insertions(+), 23 deletions(-) diff --git a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix index 3111fea1b400..2a77029d136e 100644 --- a/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix +++ b/pkgs/development/compilers/graalvm/community-edition/buildGraalvm.nix @@ -4,24 +4,45 @@ , autoPatchelfHook , cairo , cups +, darwin , fontconfig -, Foundation , glib , gtk3 -, gtkSupport ? stdenv.isLinux , makeWrapper , setJavaClassPath , unzip , xorg , zlib -}: -{ javaVersion + # extra params +, javaVersion , meta ? { } , products ? [ ] +, gtkSupport ? stdenv.isLinux , ... } @ args: let + extraArgs = builtins.removeAttrs args [ + "lib" + "stdenv" + "alsa-lib" + "autoPatchelfHook" + "cairo" + "cups" + "darwin" + "fontconfig" + "glib" + "gtk3" + "makeWrapper" + "setJavaClassPath" + "unzip" + "xorg" + "zlib" + "javaVersion" + "meta" + "products" + "gtkSupport" + ]; runtimeLibraryPath = lib.makeLibraryPath ([ cups ] ++ lib.optionals gtkSupport [ cairo glib gtk3 ]); mapProducts = key: default: (map (p: p.graalvmPhases.${key} or default) products); @@ -72,7 +93,7 @@ let ++ lib.optional stdenv.isLinux autoPatchelfHook; propagatedBuildInputs = [ setJavaClassPath zlib ] - ++ lib.optional stdenv.isDarwin Foundation; + ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Foundation; buildInputs = lib.optionals stdenv.isLinux [ alsa-lib # libasound.so wanted by lib/libjsound.so @@ -150,6 +171,6 @@ let mainProgram = "java"; maintainers = with maintainers; teams.graalvm-ce.members ++ [ ]; } // meta); - } // (builtins.removeAttrs args [ "javaVersion" "meta" "products" ])); + } // extraArgs); in graalvmXXX-ce diff --git a/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix b/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix index 52cf6e7e89e9..aad60e13d308 100644 --- a/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix +++ b/pkgs/development/compilers/graalvm/community-edition/buildGraalvmProduct.nix @@ -6,8 +6,8 @@ , perl , unzip , zlib -}: -{ product + # extra params +, product , javaVersion , extraBuildInputs ? [ ] , extraNativeBuildInputs ? [ ] @@ -17,6 +17,25 @@ , ... } @ args: +let + extraArgs = builtins.removeAttrs args [ + "lib" + "stdenv" + "autoPatchelfHook" + "graalvm-ce" + "makeWrapper" + "perl" + "unzip" + "zlib" + "product" + "javaVersion" + "extraBuildInputs" + "extraNativeBuildInputs" + "graalvmPhases" + "meta" + "passthru" + ]; +in stdenv.mkDerivation ({ pname = "${product}-java${javaVersion}"; @@ -73,12 +92,4 @@ stdenv.mkDerivation ({ 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" -])) +} // extraArgs) diff --git a/pkgs/development/compilers/graalvm/community-edition/default.nix b/pkgs/development/compilers/graalvm/community-edition/default.nix index afc0456c9746..9eafd12b97e9 100644 --- a/pkgs/development/compilers/graalvm/community-edition/default.nix +++ b/pkgs/development/compilers/graalvm/community-edition/default.nix @@ -2,12 +2,11 @@ , stdenv , callPackage , fetchurl -, Foundation }: let - buildGraalvm = lib.makeOverridable (callPackage ./buildGraalvm.nix { inherit Foundation; }); - buildGraalvmProduct = lib.makeOverridable (callPackage ./buildGraalvmProduct.nix { }); + buildGraalvm = callPackage ./buildGraalvm.nix; + buildGraalvmProduct = callPackage ./buildGraalvmProduct.nix; javaPlatform = { "aarch64-linux" = "linux-aarch64"; "x86_64-linux" = "linux-amd64"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 005e63be84a7..727caeb072a2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15014,9 +15014,7 @@ with pkgs; openjdk_headless = jdk_headless; graalvmCEPackages = - recurseIntoAttrs (callPackage ../development/compilers/graalvm/community-edition { - inherit (darwin.apple_sdk.frameworks) Foundation; - }); + recurseIntoAttrs (callPackage ../development/compilers/graalvm/community-edition { }); graalvm-ce = graalvm11-ce; graalvm11-ce = graalvmCEPackages.graalvm11-ce; graalvm17-ce = graalvmCEPackages.graalvm17-ce;