julia_1{9,10}-bin: deduplicate common code

This commit is contained in:
Nick Cao 2024-01-11 21:48:47 -05:00
parent e2ada3ce79
commit 849371a0a5
No known key found for this signature in database
3 changed files with 46 additions and 115 deletions

View file

@ -1,104 +0,0 @@
{ autoPatchelfHook, fetchurl, lib, stdenv }:
let
skip_tests = [
# Test flaky on ofborg
"channels"
# Test flaky because of our RPATH patching
# https://github.com/NixOS/nixpkgs/pull/230965#issuecomment-1545336489
"compiler/codegen"
] ++ lib.optionals stdenv.isDarwin [
# Test flaky on ofborg
"FileWatching"
# Test requires pbcopy
"InteractiveUtils"
# Test requires network access
"Sockets"
] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
# Test Failed at $out/share/julia/stdlib/v1.8/LinearAlgebra/test/blas.jl:702
"LinearAlgebra/blas"
# Test Failed at $out/share/julia/test/misc.jl:724
"misc"
];
in
stdenv.mkDerivation rec {
pname = "julia-bin";
version = "1.9.4";
src = {
x86_64-linux = fetchurl {
url = "https://julialang-s3.julialang.org/bin/linux/x64/${lib.versions.majorMinor version}/julia-${version}-linux-x86_64.tar.gz";
sha256 = "07d20c4c2518833e2265ca0acee15b355463361aa4efdab858dad826cf94325c";
};
aarch64-linux = fetchurl {
url = "https://julialang-s3.julialang.org/bin/linux/aarch64/${lib.versions.majorMinor version}/julia-${version}-linux-aarch64.tar.gz";
sha256 = "541d0c5a9378f8d2fc384bb8595fc6ffe20d61054629a6e314fb2f8dfe2f2ade";
};
x86_64-darwin = fetchurl {
url = "https://julialang-s3.julialang.org/bin/mac/x64/${lib.versions.majorMinor version}/julia-${version}-mac64.tar.gz";
sha256 = "67eec264f6afc9e9bf72c0f62c84d91c2ebdfaed6a0aa11606e3c983d278b441";
};
aarch64-darwin = fetchurl {
url = "https://julialang-s3.julialang.org/bin/mac/aarch64/${lib.versions.majorMinor version}/julia-${version}-macaarch64.tar.gz";
sha256 = "67542975e86102eec95bc4bb7c30c5d8c7ea9f9a0b388f0e10f546945363b01a";
};
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
patches = [
# https://github.com/JuliaLang/julia/commit/f5eeba35d9bf20de251bb9160cc935c71e8b19ba
./patches/1.9-bin/0001-allow-skipping-internet-required-tests.patch
];
postPatch = ''
# Julia fails to pick up our Certification Authority root certificates, but
# it provides its own so we can simply disable the test. Patching in the
# dynamic path to ours require us to rebuild the Julia system image.
substituteInPlace share/julia/stdlib/v${lib.versions.majorMinor version}/NetworkOptions/test/runtests.jl \
--replace '@test ca_roots_path() != bundled_ca_roots()' \
'@test_skip ca_roots_path() != bundled_ca_roots()'
'';
nativeBuildInputs = lib.optionals stdenv.isLinux [
autoPatchelfHook
# https://github.com/JuliaLang/julia/blob/v1.9.0/NEWS.md#external-dependencies
stdenv.cc.cc
];
installPhase = ''
runHook preInstall
cp -r . $out
runHook postInstall
'';
# Breaks backtraces, etc.
dontStrip = true;
doInstallCheck = true;
preInstallCheck = ''
export JULIA_TEST_USE_MULTIPLE_WORKERS=true
# Some tests require read/write access to $HOME.
export HOME="$TMPDIR"
'';
installCheckPhase = ''
runHook preInstallCheck
# Command lifted from `test/Makefile`.
$out/bin/julia \
--check-bounds=yes \
--startup-file=no \
--depwarn=error \
$out/share/julia/test/runtests.jl \
--skip internet_required ${toString skip_tests}
runHook postInstallCheck
'';
meta = {
description = "High-level, high-performance, dynamic language for technical computing";
homepage = "https://julialang.org";
# Bundled and linked with various GPL code, although Julia itself is MIT.
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ raskin nickcao wegank thomasjm ];
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
mainProgram = "julia";
};
}

View file

@ -13,8 +13,32 @@ in
{
julia_16-bin = wrapJulia (callPackage ./1.6-bin.nix { });
julia_19-bin = wrapJulia (callPackage ./1.9-bin.nix { });
julia_110-bin = wrapJulia (callPackage ./1.10-bin.nix { });
julia_19-bin = wrapJulia (callPackage
(import ./generic-bin.nix {
version = "1.9.4";
sha256 = {
x86_64-linux = "07d20c4c2518833e2265ca0acee15b355463361aa4efdab858dad826cf94325c";
aarch64-linux = "541d0c5a9378f8d2fc384bb8595fc6ffe20d61054629a6e314fb2f8dfe2f2ade";
x86_64-darwin = "67eec264f6afc9e9bf72c0f62c84d91c2ebdfaed6a0aa11606e3c983d278b441";
aarch64-darwin = "67542975e86102eec95bc4bb7c30c5d8c7ea9f9a0b388f0e10f546945363b01a";
};
patches = [
# https://github.com/JuliaLang/julia/commit/f5eeba35d9bf20de251bb9160cc935c71e8b19ba
./patches/1.9-bin/0001-allow-skipping-internet-required-tests.patch
];
})
{ });
julia_110-bin = wrapJulia (callPackage
(import ./generic-bin.nix {
version = "1.10.0";
sha256 = {
x86_64-linux = "a7298207f72f2b27b2ab1ce392a6ea37afbd1fbee0f1f8d190b054dcaba878fe";
aarch64-linux = "048d96b4398efd524e94be3f49e8829cf6b30c8f3f4b46c75751a4679635e45b";
x86_64-darwin = "eb1cdf2d373ee40412e8f5ee6b4681916f1ead6d794883903619c7bf147d4f46";
aarch64-darwin = "dc4ca01b1294c02d47b33ef26d489dc288ac68655a03774870c6872b82a9a7d6";
};
})
{ });
julia_19 = wrapJulia (callPackage
(import ./generic.nix {
version = "1.9.4";

View file

@ -1,14 +1,22 @@
{ autoPatchelfHook, fetchurl, lib, stdenv }:
{ version
, sha256
, patches ? [ ]
}:
{ autoPatchelfHook
, fetchurl
, lib
, stdenv
}:
let
skip_tests = [
# Test flaky on ofborg
"channels"
# Test flaky because of our RPATH patching
# https://github.com/NixOS/nixpkgs/pull/230965#issuecomment-1545336489
"compiler/codegen"
] ++ lib.optionals (lib.versionAtLeast version "1.10") [
# Test flaky
# https://github.com/JuliaLang/julia/issues/52739
"REPL"
@ -26,26 +34,27 @@ let
"misc"
];
in
stdenv.mkDerivation rec {
stdenv.mkDerivation {
pname = "julia-bin";
version = "1.10.0";
inherit version patches;
src = {
x86_64-linux = fetchurl {
url = "https://julialang-s3.julialang.org/bin/linux/x64/${lib.versions.majorMinor version}/julia-${version}-linux-x86_64.tar.gz";
sha256 = "a7298207f72f2b27b2ab1ce392a6ea37afbd1fbee0f1f8d190b054dcaba878fe";
sha256 = sha256.x86_64-linux;
};
aarch64-linux = fetchurl {
url = "https://julialang-s3.julialang.org/bin/linux/aarch64/${lib.versions.majorMinor version}/julia-${version}-linux-aarch64.tar.gz";
sha256 = "048d96b4398efd524e94be3f49e8829cf6b30c8f3f4b46c75751a4679635e45b";
sha256 = sha256.aarch64-linux;
};
x86_64-darwin = fetchurl {
url = "https://julialang-s3.julialang.org/bin/mac/x64/${lib.versions.majorMinor version}/julia-${version}-mac64.tar.gz";
sha256 = "eb1cdf2d373ee40412e8f5ee6b4681916f1ead6d794883903619c7bf147d4f46";
sha256 = sha256.x86_64-darwin;
};
aarch64-darwin = fetchurl {
url = "https://julialang-s3.julialang.org/bin/mac/aarch64/${lib.versions.majorMinor version}/julia-${version}-macaarch64.tar.gz";
sha256 = "dc4ca01b1294c02d47b33ef26d489dc288ac68655a03774870c6872b82a9a7d6";
sha256 = sha256.aarch64-darwin;
};
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
@ -74,12 +83,14 @@ stdenv.mkDerivation rec {
dontStrip = true;
doInstallCheck = true;
preInstallCheck = ''
export JULIA_TEST_USE_MULTIPLE_WORKERS=true
# Some tests require read/write access to $HOME.
# And $HOME cannot be equal to $TMPDIR as it causes test failures
export HOME=$(mktemp -d)
'';
installCheckPhase = ''
runHook preInstallCheck
# Command lifted from `test/Makefile`.