graalvmXX-ce: new update script
This commit is contained in:
@@ -4,14 +4,36 @@ let
|
||||
mkGraal = opts: callPackage (import ./mkGraal.nix opts) {
|
||||
inherit Foundation;
|
||||
};
|
||||
|
||||
commonProducts = [
|
||||
"graalvm-ce"
|
||||
"native-image-installable-svm"
|
||||
"ruby-installable-svm"
|
||||
"wasm-installable-svm"
|
||||
];
|
||||
|
||||
in
|
||||
{
|
||||
inherit mkGraal;
|
||||
|
||||
graalvm11-ce = mkGraal rec {
|
||||
config = {
|
||||
x86_64-darwin = {
|
||||
arch = "darwin-amd64";
|
||||
products = commonProducts ++ [ "python-installable-svm" ];
|
||||
};
|
||||
x86_64-linux = {
|
||||
arch = "linux-amd64";
|
||||
products = commonProducts ++ [ "python-installable-svm" ];
|
||||
};
|
||||
aarch64-linux = {
|
||||
arch = "linux-aarch64";
|
||||
products = commonProducts;
|
||||
};
|
||||
};
|
||||
version = "22.0.0.2";
|
||||
javaVersion = "11";
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
|
||||
platforms = builtins.attrNames config;
|
||||
};
|
||||
|
||||
# TODO: fix aarch64-linux, failing during Native Image compilation
|
||||
@@ -20,8 +42,18 @@ in
|
||||
# directory"/tmp/SVM-4194439592488143713"): error=0, Failed to exec spawn
|
||||
# helper: pid: 19865, exit value: 1"
|
||||
graalvm17-ce = mkGraal rec {
|
||||
config = {
|
||||
x86_64-darwin = {
|
||||
arch = "darwin-amd64";
|
||||
products = commonProducts ++ [ "python-installable-svm" ];
|
||||
};
|
||||
x86_64-linux = {
|
||||
arch = "linux-amd64";
|
||||
products = commonProducts ++ [ "python-installable-svm" ];
|
||||
};
|
||||
};
|
||||
version = "22.0.0.2";
|
||||
javaVersion = "17";
|
||||
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
||||
platforms = builtins.attrNames config;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"darwin-amd64": {
|
||||
"graalvm-ce_java11_22.0.0.2": {
|
||||
"sha256": "8280159b8a66c51a839c8079d885928a7f759d5da0632f3af7300df2b63a6323",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java11-darwin-amd64-22.0.0.2.tar.gz"
|
||||
},
|
||||
"native-image-installable-svm_java11_22.0.0.2": {
|
||||
"sha256": "03c27de6cce61ee8073e89252212457f3fbac2c0bc9bfa4acbff12176476c176",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/native-image-installable-svm-java11-darwin-amd64-22.0.0.2.jar"
|
||||
},
|
||||
"python-installable-svm_java11_22.0.0.2": {
|
||||
"sha256": "67ee2f1cc10b0189e359344c31b22f423e636ff4ec2dd7d9437c3eb0ef54e601",
|
||||
"url": "https://github.com/graalvm/graalpython/releases/download/vm-22.0.0.2/python-installable-svm-java11-darwin-amd64-22.0.0.2.jar"
|
||||
},
|
||||
"ruby-installable-svm_java11_22.0.0.2": {
|
||||
"sha256": "a25c0099a21ca1ca9904dd3acdeef509f67a13b96c6135b6de199e9805330df9",
|
||||
"url": "https://github.com/oracle/truffleruby/releases/download/vm-22.0.0.2/ruby-installable-svm-java11-darwin-amd64-22.0.0.2.jar"
|
||||
},
|
||||
"wasm-installable-svm_java11_22.0.0.2": {
|
||||
"sha256": "d74c210a8a87b8eb0c4d18a65fde6f2c03ebc94d9bf7ed87bbb9cacc460006d7",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/wasm-installable-svm-java11-darwin-amd64-22.0.0.2.jar"
|
||||
}
|
||||
},
|
||||
"linux-aarch64": {
|
||||
"graalvm-ce_java11_22.0.0.2": {
|
||||
"sha256": "1cc0263d95f642dada4e290dca7f49c0456cefa7b690b67e3e5c159b537b2c58",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java11-linux-aarch64-22.0.0.2.tar.gz"
|
||||
},
|
||||
"native-image-installable-svm_java11_22.0.0.2": {
|
||||
"sha256": "51d41e890a5aabf8e7b9d4f4e0f88206ee70a261f7dbb0315d51770ab8f3009e",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/native-image-installable-svm-java11-linux-aarch64-22.0.0.2.jar"
|
||||
},
|
||||
"ruby-installable-svm_java11_22.0.0.2": {
|
||||
"sha256": "e0fb582a9c6b4167e7dc267c58ca1968bd1c471b3bc5c56061b436f175486d80",
|
||||
"url": "https://github.com/oracle/truffleruby/releases/download/vm-22.0.0.2/ruby-installable-svm-java11-linux-aarch64-22.0.0.2.jar"
|
||||
},
|
||||
"wasm-installable-svm_java11_22.0.0.2": {
|
||||
"sha256": "a48470ae391c75cb2805b7fe27cde2c925c0466fdbc0623dfbb67c54f19dbf8c",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/wasm-installable-svm-java11-linux-aarch64-22.0.0.2.jar"
|
||||
}
|
||||
},
|
||||
"linux-amd64": {
|
||||
"graalvm-ce_java11_22.0.0.2": {
|
||||
"sha256": "bc86083bb7e2778c7e4fe4f55d74790e42255b96f7806a7fefa51d06f3bc7103",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java11-linux-amd64-22.0.0.2.tar.gz"
|
||||
},
|
||||
"native-image-installable-svm_java11_22.0.0.2": {
|
||||
"sha256": "8504a3441f5b28b8fd625f676674a9216f082ae63a4e30d43930c80f9672e71d",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/native-image-installable-svm-java11-linux-amd64-22.0.0.2.jar"
|
||||
},
|
||||
"python-installable-svm_java11_22.0.0.2": {
|
||||
"sha256": "2f01d1bbc2ed2c507952d8ceaab1cb2176fc67e2d8c4b3bf5864e8d930c60c55",
|
||||
"url": "https://github.com/graalvm/graalpython/releases/download/vm-22.0.0.2/python-installable-svm-java11-linux-amd64-22.0.0.2.jar"
|
||||
},
|
||||
"ruby-installable-svm_java11_22.0.0.2": {
|
||||
"sha256": "e90f7ebc13b6c1f8e3f98881bb4fe2336870744174b2b6d41dc672d15f0b9a40",
|
||||
"url": "https://github.com/oracle/truffleruby/releases/download/vm-22.0.0.2/ruby-installable-svm-java11-linux-amd64-22.0.0.2.jar"
|
||||
},
|
||||
"wasm-installable-svm_java11_22.0.0.2": {
|
||||
"sha256": "c0fdfc40374b70f6f1597dd21660535c813dc5c3948c8a6ea9559a20f4d3fb5e",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/wasm-installable-svm-java11-linux-amd64-22.0.0.2.jar"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"darwin-amd64": {
|
||||
"graalvm-ce_java17_22.0.0.2": {
|
||||
"sha256": "d54af9d1f4d0d351827395a714ed84d2489b023b74a9c13a431cc9d31d1e8f9a",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz"
|
||||
},
|
||||
"native-image-installable-svm_java17_22.0.0.2": {
|
||||
"sha256": "007fa742cd139d447f83d776b6d78e717c9df11d56a61061a5937547c20028b7",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/native-image-installable-svm-java17-darwin-amd64-22.0.0.2.jar"
|
||||
},
|
||||
"python-installable-svm_java17_22.0.0.2": {
|
||||
"sha256": "af887b0304d5ec98fab1be2cd1fca2aa3b10e84e823142a7f274560b1e0ea7c1",
|
||||
"url": "https://github.com/graalvm/graalpython/releases/download/vm-22.0.0.2/python-installable-svm-java17-darwin-amd64-22.0.0.2.jar"
|
||||
},
|
||||
"ruby-installable-svm_java17_22.0.0.2": {
|
||||
"sha256": "fc5eb6f833136ae3fda61f46fe0af66a8454ca2f803ca35eaff7336521cb468d",
|
||||
"url": "https://github.com/oracle/truffleruby/releases/download/vm-22.0.0.2/ruby-installable-svm-java17-darwin-amd64-22.0.0.2.jar"
|
||||
},
|
||||
"wasm-installable-svm_java17_22.0.0.2": {
|
||||
"sha256": "b76e6d872ce07ca9facd5b997dbb6e557ba72aa369ddd5f1664431bd11b98796",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/wasm-installable-svm-java17-darwin-amd64-22.0.0.2.jar"
|
||||
}
|
||||
},
|
||||
"linux-aarch64": {
|
||||
"graalvm-ce_java17_22.0.0.2": {
|
||||
"sha256": "c7d78387d2a144944f26773697c1b61d3478a081a1c5e7fc20f47f1f5f3c82c7",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java17-linux-aarch64-22.0.0.2.tar.gz"
|
||||
},
|
||||
"native-image-installable-svm_java17_22.0.0.2": {
|
||||
"sha256": "798947d0a93988929d2b8e3555f7c65225e789124cd99fbc0c3aae5f350175db",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/native-image-installable-svm-java17-linux-aarch64-22.0.0.2.jar"
|
||||
},
|
||||
"ruby-installable-svm_java17_22.0.0.2": {
|
||||
"sha256": "38cd733334efdecb040087341bccf0aed8031d70eccd857695eaee6b274a5a6d",
|
||||
"url": "https://github.com/oracle/truffleruby/releases/download/vm-22.0.0.2/ruby-installable-svm-java17-linux-aarch64-22.0.0.2.jar"
|
||||
},
|
||||
"wasm-installable-svm_java17_22.0.0.2": {
|
||||
"sha256": "5a4d85324b0565c647b0a31f2a12c9192c9bdc49fca3fe57fdb95370e01c325e",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/wasm-installable-svm-java17-linux-aarch64-22.0.0.2.jar"
|
||||
}
|
||||
},
|
||||
"linux-amd64": {
|
||||
"graalvm-ce_java17_22.0.0.2": {
|
||||
"sha256": "4f743e0ed3d974b7d619ca2ed6014554e8c12e5ebbb38b9bc9e820b182169bd4",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/graalvm-ce-java17-linux-amd64-22.0.0.2.tar.gz"
|
||||
},
|
||||
"native-image-installable-svm_java17_22.0.0.2": {
|
||||
"sha256": "8c25f650d58c2649c97061cb806dfaec9e685d5d2b80afc7cf72fe61d6891831",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/native-image-installable-svm-java17-linux-amd64-22.0.0.2.jar"
|
||||
},
|
||||
"python-installable-svm_java17_22.0.0.2": {
|
||||
"sha256": "b3b78a15bd29b4eaaf0f2607e21181ca2a5b41b38ba43a3ff2656c2f6effda8a",
|
||||
"url": "https://github.com/graalvm/graalpython/releases/download/vm-22.0.0.2/python-installable-svm-java17-linux-amd64-22.0.0.2.jar"
|
||||
},
|
||||
"ruby-installable-svm_java17_22.0.0.2": {
|
||||
"sha256": "d86c9ad50cbed980fa69d69b2eccd47d31880d8c55553483f59ce9eda15628bd",
|
||||
"url": "https://github.com/oracle/truffleruby/releases/download/vm-22.0.0.2/ruby-installable-svm-java17-linux-amd64-22.0.0.2.jar"
|
||||
},
|
||||
"wasm-installable-svm_java17_22.0.0.2": {
|
||||
"sha256": "7f7e51e4a24384b3dd960c12ab9b05b1fea58a0457d6b80e3797228fab93c0bd",
|
||||
"url": "https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/wasm-installable-svm-java17-linux-amd64-22.0.0.2.jar"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{ version
|
||||
, javaVersion
|
||||
, platforms
|
||||
, hashes ? import ./hashes.nix
|
||||
, config
|
||||
, useMusl ? false
|
||||
}:
|
||||
|
||||
@@ -33,16 +33,19 @@
|
||||
, cairo
|
||||
, glib
|
||||
, gtk3
|
||||
, writeScript
|
||||
, jq
|
||||
, runtimeShell
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
assert useMusl -> stdenv.isLinux;
|
||||
|
||||
let
|
||||
platform = {
|
||||
aarch64-linux = "linux-aarch64";
|
||||
x86_64-linux = "linux-amd64";
|
||||
x86_64-darwin = "darwin-amd64";
|
||||
}.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}");
|
||||
platform = config.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
||||
name = "graalvm${javaVersion}-ce";
|
||||
sourcesFilename = "${name}-sources.json";
|
||||
sources = builtins.fromJSON (builtins.readFile (./. + "/${sourcesFilename}"));
|
||||
|
||||
runtimeLibraryPath = lib.makeLibraryPath
|
||||
([ cups ] ++ lib.optionals gtkSupport [ cairo glib gtk3 ]);
|
||||
@@ -56,21 +59,20 @@ let
|
||||
(writeShellScriptBin "${stdenv.system}-musl-gcc" ''${lib.getDev musl}/bin/musl-gcc "$@"'')
|
||||
]);
|
||||
|
||||
javaVersionPlatform = "${javaVersion}-${platform}";
|
||||
javaVersionPlatform = "${javaVersion}-${platform.arch}";
|
||||
|
||||
graalvmXXX-ce = stdenv.mkDerivation rec {
|
||||
inherit version;
|
||||
name = "graalvm${javaVersion}-ce";
|
||||
srcs =
|
||||
let
|
||||
# Some platforms doesn't have all GraalVM features
|
||||
# e.g.: GraalPython on aarch64-linux
|
||||
# When the platform doesn't have a feature, sha256 is null on hashes.nix
|
||||
# To update hashes.nix file, run `./update.sh <graalvm-ce-version>`
|
||||
maybeFetchUrl = url: if url.sha256 != null then (fetchurl url) else null;
|
||||
inherit version name;
|
||||
srcs = map fetchurl (builtins.attrValues sources.${platform.arch});
|
||||
/*let
|
||||
# Some platforms doesn't have all GraalVM features
|
||||
# e.g.: GraalPython on aarch64-linux
|
||||
# When the platform doesn't have a feature, sha256 is null on hashes.nix
|
||||
# To update hashes.nix file, run `./update.sh <graalvm-ce-version>`
|
||||
maybeFetchUrl = url: if url.sha256 != null then (fetchurl url) else null;
|
||||
in
|
||||
(lib.remove null
|
||||
(map maybeFetchUrl (hashes { inherit javaVersionPlatform; })));
|
||||
(map maybeFetchUrl (hashes { inherit javaVersionPlatform; })));*/
|
||||
|
||||
buildInputs = lib.optionals stdenv.isLinux [
|
||||
alsa-lib # libasound.so wanted by lib/libjsound.so
|
||||
@@ -86,7 +88,7 @@ let
|
||||
zlib
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ unzip perl autoPatchelfHook makeWrapper ];
|
||||
nativeBuildInputs = [ unzip perl makeWrapper ] ++ lib.optional stdenv.isLinux [ autoPatchelfHook ];
|
||||
|
||||
unpackPhase = ''
|
||||
unpack_jar() {
|
||||
@@ -149,7 +151,7 @@ let
|
||||
else
|
||||
"for f in ${glibc}/lib/* ${glibc.static}/lib/* ${zlib.static}/lib/*; do"
|
||||
}
|
||||
ln -s $f ${basepath}/${platform}/$(basename $f)
|
||||
ln -s $f ${basepath}/${platform.arch}/$(basename $f)
|
||||
done
|
||||
'';
|
||||
copyClibrariesToLib = ''
|
||||
@@ -185,6 +187,7 @@ let
|
||||
'';
|
||||
"11-darwin-amd64" = "";
|
||||
"17-darwin-amd64" = "";
|
||||
"17-darwin-aarch64" = "";
|
||||
}.${javaVersionPlatform} + ''
|
||||
# ensure that $lib/lib exists to avoid breaking builds
|
||||
mkdir -p $lib/lib
|
||||
@@ -281,7 +284,7 @@ let
|
||||
}
|
||||
|
||||
${
|
||||
lib.optionalString (platform != "linux-aarch64") ''
|
||||
lib.optionalString (platform.arch != "linux-aarch64" && platform.arch != "darwin-aarch64") ''
|
||||
echo "Testing GraalPython"
|
||||
$out/bin/graalpython -c 'print(1 + 1)'
|
||||
echo '1 + 1' | $out/bin/graalpython
|
||||
@@ -289,10 +292,14 @@ let
|
||||
}
|
||||
|
||||
echo "Testing TruffleRuby"
|
||||
${
|
||||
lib.optionalString (platform != "darwin-aarch64") ''
|
||||
# Hide warnings about wrong locale
|
||||
export LANG=C
|
||||
export LC_ALL=C
|
||||
$out/bin/ruby -e 'puts(1 + 1)'
|
||||
''
|
||||
}
|
||||
${# FIXME: irb is broken in all platforms
|
||||
# TODO: `irb` on MacOS gives an error saying "Could not find OpenSSL
|
||||
# headers, install via Homebrew or MacPorts or set OPENSSL_PREFIX", even
|
||||
@@ -311,7 +318,11 @@ let
|
||||
|
||||
passthru = {
|
||||
home = graalvmXXX-ce;
|
||||
updateScript = ./update.sh;
|
||||
updateScript = import ./update.nix {
|
||||
inherit lib writeScript jq runtimeShell sourcesFilename config;
|
||||
graalVersion = version;
|
||||
javaVersion = "java${javaVersion}";
|
||||
};
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
{
|
||||
javaVersion,
|
||||
graalVersion,
|
||||
config,
|
||||
sourcesFilename,
|
||||
lib,
|
||||
writeScript,
|
||||
jq,
|
||||
runtimeShell
|
||||
}:
|
||||
|
||||
let
|
||||
# getArchString :: String -> String
|
||||
getArchString = nixArchString:
|
||||
{
|
||||
"aarch64-linux" = "linux-aarch64";
|
||||
"x86_64-linux" = "linux-amd64";
|
||||
"x86_64-darwin" = "darwin-amd64";
|
||||
}.${nixArchString};
|
||||
|
||||
|
||||
# getProductSuffix :: String -> String
|
||||
getProductSuffix = productName:
|
||||
let suffixes = {
|
||||
"graalvm-ce" = ".tar.gz";
|
||||
"native-image-installable-svm" = ".jar";
|
||||
"ruby-installable-svm" = ".jar";
|
||||
"wasm-installable-svm" = ".jar";
|
||||
"python-installable-svm" = ".jar";
|
||||
};
|
||||
in
|
||||
suffixes.${productName};
|
||||
|
||||
# getProductSuffix :: String -> String
|
||||
getProductBaseUrl = productName:
|
||||
let baseUrls = {
|
||||
"graalvm-ce" = "https://github.com/graalvm/graalvm-ce-builds/releases/download";
|
||||
"native-image-installable-svm" = "https://github.com/graalvm/graalvm-ce-builds/releases/download";
|
||||
"ruby-installable-svm" = "https://github.com/oracle/truffleruby/releases/download";
|
||||
"wasm-installable-svm" = "https://github.com/graalvm/graalvm-ce-builds/releases/download";
|
||||
"python-installable-svm" = "https://github.com/graalvm/graalpython/releases/download";
|
||||
};
|
||||
in
|
||||
baseUrls.${productName};
|
||||
|
||||
# generateUrl :: AttrSet -> String
|
||||
generateUrl = { arch, graalVersion, product, javaVersion }:
|
||||
|
||||
let baseUrl = getProductBaseUrl product;
|
||||
in
|
||||
"${baseUrl}/vm-${graalVersion}/${product}-${javaVersion}-${arch}-${graalVersion}${getProductSuffix product}";
|
||||
|
||||
# downloadSha256 :: AttrSet -> String
|
||||
downloadSha256 = args@{ arch, graalVersion, product, javaVersion }:
|
||||
let url = generateUrl args + ".sha256";
|
||||
in
|
||||
builtins.readFile (builtins.fetchurl url);
|
||||
|
||||
# cartesianZipListsWith :: (a -> b -> c) -> [a] -> [b] -> [c]
|
||||
cartesianZipListsWith = f: fst: snd:
|
||||
let cartesianProduct = lib.cartesianProductOfSets { a = fst; b = snd; };
|
||||
fst' = builtins.catAttrs "a" cartesianProduct;
|
||||
snd' = builtins.catAttrs "b" cartesianProduct;
|
||||
in
|
||||
lib.zipListsWith f fst' snd';
|
||||
|
||||
# zipListsToAttrs :: [a] -> [b] -> AttrSet
|
||||
zipListsToAttrs = names: values:
|
||||
lib.listToAttrs (
|
||||
lib.zipListsWith (name: value: { inherit name value; }) names values
|
||||
);
|
||||
|
||||
# genProductJavaVersionGraalVersionAttrSet :: String -> AttrSet
|
||||
genProductJavaVersionGraalVersionAttrSet = product_javaVersion_graalVersion:
|
||||
let attrNames = [ "product" "javaVersion" "graalVersion" ];
|
||||
attrValues = lib.splitString "_" product_javaVersion_graalVersion;
|
||||
in zipListsToAttrs attrNames attrValues;
|
||||
|
||||
# genUrlAndSha256 :: String -> String -> AttrSet
|
||||
genUrlAndSha256 = arch: product_javaVersion_graalVersion:
|
||||
let
|
||||
productJavaVersionGraalVersion =
|
||||
(genProductJavaVersionGraalVersionAttrSet product_javaVersion_graalVersion)
|
||||
// { inherit arch; };
|
||||
url = generateUrl productJavaVersionGraalVersion;
|
||||
sha256 = downloadSha256 productJavaVersionGraalVersion;
|
||||
in
|
||||
{
|
||||
${arch} = {
|
||||
${product_javaVersion_graalVersion} = {
|
||||
inherit sha256 url;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# genArchProductVersionPairs :: String -> AttrSet -> [AttrSet]
|
||||
genArchProductVersionList = javaGraalVersion: archProducts:
|
||||
let
|
||||
arch = archProducts.arch;
|
||||
products = archProducts.products;
|
||||
productJavaGraalVersionList =
|
||||
cartesianZipListsWith (a: b: a + "_" + b) products [ javaGraalVersion ];
|
||||
in
|
||||
cartesianZipListsWith (genUrlAndSha256) [ arch ] productJavaGraalVersionList;
|
||||
|
||||
|
||||
# genSources :: String -> String -> AttrSet -> Path String
|
||||
genSources = graalVersion: javaVersion: config:
|
||||
let
|
||||
javaGraalVersion = javaVersion + "_" + graalVersion; # java17_20.2.0.2
|
||||
archProducts = builtins.attrValues config;
|
||||
sourcesList = builtins.concatMap (genArchProductVersionList javaGraalVersion) archProducts;
|
||||
sourcesAttr = builtins.foldl' (lib.recursiveUpdate) {} sourcesList;
|
||||
in
|
||||
builtins.toFile "sources.json" (builtins.toJSON sourcesAttr);
|
||||
|
||||
sourcesJson = genSources graalVersion javaVersion config;
|
||||
|
||||
in
|
||||
writeScript "update-graal.sh" ''
|
||||
#!${runtimeShell}
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
export PATH="${lib.makeBinPath [ jq ]}:$PATH"
|
||||
|
||||
jq . ${sourcesJson} > ${lib.strings.escapeShellArg ./.}/${sourcesFilename}
|
||||
''
|
||||
Reference in New Issue
Block a user