git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #123188 from ninjin/julia-bin

julia: init julia_10-bin and julia_16-bin

commit183350a3e1d7882838fd328538619f99d3ab51f4 authorMichael Raskin <7c6f434c@mail.ru> dateMon 17 May 2021, 11:55 (6 years ago) parentc7e671b8949ae1
7 files changed+324
pkgs/development/compilers/julia/1.0-bin.nix+72 pkgs/development/compilers/julia/1.6-bin.nix+73 pkgs/development/compilers/julia/patches/1.0-bin/0002-nix-Skip-tests-that-require-network-access.patch+87 pkgs/development/compilers/julia/patches/1.6-bin/0002-nix-Skip-tempname-test-broken-in-sandbox.patch+28 pkgs/development/compilers/julia/patches/1.6-bin/0003-nix-Skip-chown-tests-broken-in-sandbox.patch+27 pkgs/development/compilers/julia/patches/1.6-bin/0005-nix-Enable-parallel-unit-tests-for-sandbox.patch+30 pkgs/top-level/all-packages.nix+7
pkgs/development/compilers/julia/1.0-bin.nixnew file+72
@@ -0,0 +1,72 @@
1+{ autoPatchelfHook, fetchurl, lib, makeWrapper, openssl, stdenv }:
2+
3+stdenv.mkDerivation rec {
4+ pname = "julia-bin";
5+ version = "1.0.5";
6+
7+ src = {
8+ x86_64-linux = fetchurl {
9+ url = "https://julialang-s3.julialang.org/bin/linux/x64/${lib.versions.majorMinor version}/julia-${version}-linux-x86_64.tar.gz";
10+ sha256 = "00vbszpjmz47nqy19v83xa463ajhzwanjyg5mvcfp9kvfw9xdvcx";
11+ };
12+ }.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
13+
14+ # Julia’s source files are in different locations for source and binary
15+ # releases. Thus we temporarily create symlinks to allow us to share patches
16+ # with source releases.
17+ prePatch = ''
18+ ln -s share/julia/stdlib/v${lib.versions.majorMinor version} stdlib
19+ ln -s share/julia/test
20+ '';
21+ patches = [
22+ # Source release Nix patch(es) relevant for binary releases as well.
23+ ./patches/1.0-bin/0002-nix-Skip-tests-that-require-network-access.patch
24+ ];
25+ postPatch = ''
26+ # Revert symlink hack.
27+ rm stdlib test
28+ '';
29+
30+ buildInputs = [ makeWrapper ];
31+ nativeBuildInputs = [ autoPatchelfHook ];
32+
33+ installPhase = ''
34+ runHook preInstall
35+ cp -r . $out
36+ # Setting `LD_LIBRARY_PATH` resolves `Libdl` failures. Not sure why this is
37+ # only necessary on v1.0.x and a cleaner solution is welcome, but after
38+ # staring at `strace` for a few hours this is as clean as I could make it.
39+ wrapProgram $out/bin/julia \
40+ --suffix LD_LIBRARY_PATH : $out/lib
41+ runHook postInstall
42+ '';
43+
44+ # Breaks backtraces, etc.
45+ dontStrip = true;
46+
47+ doInstallCheck = true;
48+ installCheckInputs = [ openssl ];
49+ preInstallCheck = ''
50+ # Some tests require read/write access to $HOME.
51+ export HOME="$TMPDIR"
52+ '';
53+ installCheckPhase = ''
54+ runHook preInstallCheck
55+ # Command lifted from `test/Makefile`.
56+ $out/bin/julia \
57+ --check-bounds=yes \
58+ --startup-file=no \
59+ --depwarn=error \
60+ $out/share/julia/test/runtests.jl
61+ runHook postInstallCheck
62+ '';
63+
64+ meta = {
65+ description = "High-level, high-performance dynamic language for technical computing";
66+ homepage = "https://julialang.org";
67+ # Bundled and linked with various GPL code, although Julia itself is MIT.
68+ license = lib.licenses.gpl2Plus;
69+ maintainers = with lib.maintainers; [ ninjin raskin ];
70+ platforms = [ "x86_64-linux" ];
71+ };
72+}
pkgs/development/compilers/julia/1.6-bin.nixnew file+73
@@ -0,0 +1,73 @@
1+{ autoPatchelfHook, fetchurl, lib, stdenv }:
2+
3+stdenv.mkDerivation rec {
4+ pname = "julia-bin";
5+ version = "1.6.1";
6+
7+ src = {
8+ x86_64-linux = fetchurl {
9+ url = "https://julialang-s3.julialang.org/bin/linux/x64/${lib.versions.majorMinor version}/julia-${version}-linux-x86_64.tar.gz";
10+ sha256 = "01i5sm4vqb0y5qznql571zap19b42775drrcxnzsyhpaqgg8m23w";
11+ };
12+ }.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
13+
14+ # Julia’s source files are in different locations for source and binary
15+ # releases. Thus we temporarily create a symlink to allow us to share patches
16+ # with source releases.
17+ prePatch = ''
18+ ln -s share/julia/test
19+ '';
20+ patches = [
21+ # Source release Nix patch(es) relevant for binary releases as well.
22+ ./patches/1.6-bin/0002-nix-Skip-tempname-test-broken-in-sandbox.patch
23+ ./patches/1.6-bin/0003-nix-Skip-chown-tests-broken-in-sandbox.patch
24+ ./patches/1.6-bin/0005-nix-Enable-parallel-unit-tests-for-sandbox.patch
25+ ];
26+ postPatch = ''
27+ # Revert symlink hack.
28+ rm test
29+
30+ # Julia fails to pick up our Certification Authority root certificates, but
31+ # it provides its own so we can simply disable the test. Patching in the
32+ # dynamic path to ours require us to rebuild the Julia system image.
33+ substituteInPlace share/julia/stdlib/v${lib.versions.majorMinor version}/NetworkOptions/test/runtests.jl \
34+ --replace '@test ca_roots_path() != bundled_ca_roots()' \
35+ '@test_skip ca_roots_path() != bundled_ca_roots()'
36+ '';
37+
38+ nativeBuildInputs = [ autoPatchelfHook ];
39+
40+ installPhase = ''
41+ runHook preInstall
42+ cp -r . $out
43+ runHook postInstall
44+ '';
45+
46+ # Breaks backtraces, etc.
47+ dontStrip = true;
48+
49+ doInstallCheck = true;
50+ preInstallCheck = ''
51+ # Some tests require read/write access to $HOME.
52+ export HOME="$TMPDIR"
53+ '';
54+ installCheckPhase = ''
55+ runHook preInstallCheck
56+ # Command lifted from `test/Makefile`.
57+ $out/bin/julia \
58+ --check-bounds=yes \
59+ --startup-file=no \
60+ --depwarn=error \
61+ $out/share/julia/test/runtests.jl
62+ runHook postInstallCheck
63+ '';
64+
65+ meta = {
66+ description = "High-level, high-performance dynamic language for technical computing.";
67+ homepage = "https://julialang.org";
68+ # Bundled and linked with various GPL code, although Julia itself is MIT.
69+ license = lib.licenses.gpl2Plus;
70+ maintainers = with lib.maintainers; [ ninjin raskin ];
71+ platforms = [ "x86_64-linux" ];
72+ };
73+}
pkgs/development/compilers/julia/patches/1.0-bin/0002-nix-Skip-tests-that-require-network-access.patchnew file+87
@@ -0,0 +1,87 @@
1+From 4954b99efae367da49412edd31a7bd832ec62c69 Mon Sep 17 00:00:00 2001
2+From: Pontus Stenetorp <pontus@stenetorp.se>
3+Date: Mon, 15 Mar 2021 05:55:18 +0000
4+Subject: [PATCH 2/3] nix: Skip tests that require network access
5+
6+Necessary as the Nix build sandbox does not permit network access.
7+---
8+ stdlib/Sockets/test/runtests.jl | 40 ++++++++++++++++-----------------
9+ test/file.jl | 4 ++--
10+ 2 files changed, 22 insertions(+), 22 deletions(-)
11+
12+diff --git a/stdlib/Sockets/test/runtests.jl b/stdlib/Sockets/test/runtests.jl
13+index 6145f87616..9cc7a001e5 100644
14+--- a/stdlib/Sockets/test/runtests.jl
15++++ b/stdlib/Sockets/test/runtests.jl
16+@@ -151,33 +151,33 @@ defaultport = rand(2000:4000)
17+ end
18+
19+ @testset "getnameinfo on some unroutable IP addresses (RFC 5737)" begin
20+- @test getnameinfo(ip"192.0.2.1") == "192.0.2.1"
21+- @test getnameinfo(ip"198.51.100.1") == "198.51.100.1"
22+- @test getnameinfo(ip"203.0.113.1") == "203.0.113.1"
23+- @test getnameinfo(ip"0.1.1.1") == "0.1.1.1"
24+- @test getnameinfo(ip"::ffff:0.1.1.1") == "::ffff:0.1.1.1"
25+- @test getnameinfo(ip"::ffff:192.0.2.1") == "::ffff:192.0.2.1"
26+- @test getnameinfo(ip"2001:db8::1") == "2001:db8::1"
27++ @test_skip getnameinfo(ip"192.0.2.1") == "192.0.2.1"
28++ @test_skip getnameinfo(ip"198.51.100.1") == "198.51.100.1"
29++ @test_skip getnameinfo(ip"203.0.113.1") == "203.0.113.1"
30++ @test_skip getnameinfo(ip"0.1.1.1") == "0.1.1.1"
31++ @test_skip getnameinfo(ip"::ffff:0.1.1.1") == "::ffff:0.1.1.1"
32++ @test_skip getnameinfo(ip"::ffff:192.0.2.1") == "::ffff:192.0.2.1"
33++ @test_skip getnameinfo(ip"2001:db8::1") == "2001:db8::1"
34+ end
35+
36+ @testset "getnameinfo on some valid IP addresses" begin
37+ @test !isempty(getnameinfo(ip"::")::String)
38+- @test !isempty(getnameinfo(ip"0.0.0.0")::String)
39+- @test !isempty(getnameinfo(ip"10.1.0.0")::String)
40+- @test !isempty(getnameinfo(ip"10.1.0.255")::String)
41+- @test !isempty(getnameinfo(ip"10.1.255.1")::String)
42+- @test !isempty(getnameinfo(ip"255.255.255.255")::String)
43+- @test !isempty(getnameinfo(ip"255.255.255.0")::String)
44+- @test !isempty(getnameinfo(ip"192.168.0.1")::String)
45+- @test !isempty(getnameinfo(ip"::1")::String)
46++ @test_skip !isempty(getnameinfo(ip"0.0.0.0")::String)
47++ @test_skip !isempty(getnameinfo(ip"10.1.0.0")::String)
48++ @test_skip !isempty(getnameinfo(ip"10.1.0.255")::String)
49++ @test_skip !isempty(getnameinfo(ip"10.1.255.1")::String)
50++ @test_skip !isempty(getnameinfo(ip"255.255.255.255")::String)
51++ @test_skip !isempty(getnameinfo(ip"255.255.255.0")::String)
52++ @test_skip !isempty(getnameinfo(ip"192.168.0.1")::String)
53++ @test_skip !isempty(getnameinfo(ip"::1")::String)
54+ end
55+
56+ @testset "getaddrinfo" begin
57+- let localhost = getnameinfo(ip"127.0.0.1")::String
58+- @test !isempty(localhost) && localhost != "127.0.0.1"
59+- @test !isempty(getalladdrinfo(localhost)::Vector{IPAddr})
60+- @test getaddrinfo(localhost, IPv4)::IPv4 != ip"0.0.0.0"
61+- @test try
62++ let localhost = getnameinfo(ip"::")::String
63++ @test_skip !isempty(localhost) && localhost != "127.0.0.1"
64++ @test_skip !isempty(getalladdrinfo(localhost)::Vector{IPAddr})
65++ @test_skip getaddrinfo(localhost, IPv4)::IPv4 != ip"0.0.0.0"
66++ @test_skip try
67+ getaddrinfo(localhost, IPv6)::IPv6 != ip"::"
68+ catch ex
69+ isa(ex, Sockets.DNSError) && ex.code == Base.UV_EAI_NONAME && ex.host == localhost
70+diff --git a/test/file.jl b/test/file.jl
71+index e86476f975..579276f82c 100644
72+--- a/test/file.jl
73++++ b/test/file.jl
74+@@ -874,8 +874,8 @@ if !Sys.iswindows() || (Sys.windows_version() >= Sys.WINDOWS_VISTA_VER)
75+ else
76+ @test_throws ErrorException symlink(file, "ba\0d")
77+ end
78+-@test_throws ArgumentError download("good", "ba\0d")
79+-@test_throws ArgumentError download("ba\0d", "good")
80++@test_skip @test_throws ArgumentError download("good", "ba\0d")
81++@test_skip @test_throws ArgumentError download("ba\0d", "good")
82+
83+ ###################
84+ # walkdir #
85+--
86+2.29.3
87+
pkgs/development/compilers/julia/patches/1.6-bin/0002-nix-Skip-tempname-test-broken-in-sandbox.patchnew file+28
@@ -0,0 +1,28 @@
1+From ffe227676352a910754d96d92e9b06e475f28ff1 Mon Sep 17 00:00:00 2001
2+From: Pontus Stenetorp <pontus@stenetorp.se>
3+Date: Thu, 8 Apr 2021 04:25:19 +0000
4+Subject: [PATCH 2/6] nix: Skip `tempname` test broken in sandbox
5+
6+Reported upstream:
7+
8+ https://github.com/JuliaLang/julia/issues/38873
9+---
10+ test/file.jl | 2 +-
11+ 1 file changed, 1 insertion(+), 1 deletion(-)
12+
13+diff --git a/test/file.jl b/test/file.jl
14+index 0f39bc7c14..bd4dd78f62 100644
15+--- a/test/file.jl
16++++ b/test/file.jl
17+@@ -95,7 +95,7 @@ end
18+ @test dirname(t) == tempdir()
19+ mktempdir() do d
20+ t = tempname(d)
21+- @test dirname(t) == d
22++ @test_skip dirname(t) == d
23+ end
24+ @test_throws ArgumentError tempname(randstring())
25+ end
26+--
27+2.29.3
28+
pkgs/development/compilers/julia/patches/1.6-bin/0003-nix-Skip-chown-tests-broken-in-sandbox.patchnew file+27
@@ -0,0 +1,27 @@
1+From b20357fb1044d2c100172b1d5cbdf6c6d9bd3590 Mon Sep 17 00:00:00 2001
2+From: Pontus Stenetorp <pontus@stenetorp.se>
3+Date: Thu, 8 Apr 2021 05:10:39 +0000
4+Subject: [PATCH 3/6] nix: Skip `chown` tests broken in sandbox
5+
6+---
7+ test/file.jl | 4 ++--
8+ 1 file changed, 2 insertions(+), 2 deletions(-)
9+
10+diff --git a/test/file.jl b/test/file.jl
11+index bd4dd78f62..06fd4e49da 100644
12+--- a/test/file.jl
13++++ b/test/file.jl
14+@@ -503,8 +503,8 @@ if !Sys.iswindows()
15+ @test stat(file).gid == 0
16+ @test stat(file).uid == 0
17+ else
18+- @test_throws Base._UVError("chown($(repr(file)), -2, -1)", Base.UV_EPERM) chown(file, -2, -1) # Non-root user cannot change ownership to another user
19+- @test_throws Base._UVError("chown($(repr(file)), -1, -2)", Base.UV_EPERM) chown(file, -1, -2) # Non-root user cannot change group to a group they are not a member of (eg: nogroup)
20++ @test_skip @test_throws Base._UVError("chown($(repr(file)), -2, -1)", Base.UV_EPERM) chown(file, -2, -1) # Non-root user cannot change ownership to another user
21++ @test_skip @test_throws Base._UVError("chown($(repr(file)), -1, -2)", Base.UV_EPERM) chown(file, -1, -2) # Non-root user cannot change group to a group they are not a member of (eg: nogroup)
22+ end
23+ else
24+ # test that chown doesn't cause any errors for Windows
25+--
26+2.29.3
27+
pkgs/development/compilers/julia/patches/1.6-bin/0005-nix-Enable-parallel-unit-tests-for-sandbox.patchnew file+30
@@ -0,0 +1,30 @@
1+From 44c2c979c4f2222567ce65f506cf47fb87482348 Mon Sep 17 00:00:00 2001
2+From: Pontus Stenetorp <pontus@stenetorp.se>
3+Date: Thu, 8 Apr 2021 04:37:44 +0000
4+Subject: [PATCH 5/6] nix: Enable parallel unit tests for sandbox
5+
6+Disabled by default due to lack of networking in the Nix sandbox. This
7+greatly speeds up the build process on a multi-core system.
8+---
9+ test/runtests.jl | 5 +++--
10+ 1 file changed, 3 insertions(+), 2 deletions(-)
11+
12+diff --git a/test/runtests.jl b/test/runtests.jl
13+index 2f9cd058bb..2f8c19fa32 100644
14+--- a/test/runtests.jl
15++++ b/test/runtests.jl
16+@@ -83,8 +83,9 @@ prepend!(tests, linalg_tests)
17+ import LinearAlgebra
18+ cd(@__DIR__) do
19+ n = 1
20+- if net_on
21+- n = min(Sys.CPU_THREADS, length(tests))
22++ if net_on || haskey(ENV, "NIX_BUILD_CORES")
23++ x = haskey(ENV, "NIX_BUILD_CORES") ? parse(Int, ENV["NIX_BUILD_CORES"]) : Sys.CPU_THREADS
24++ n = min(x, Sys.CPU_THREADS, length(tests))
25+ n > 1 && addprocs_with_testenv(n)
26+ LinearAlgebra.BLAS.set_num_threads(1)
27+ end
28+--
29+2.29.3
30+
pkgs/top-level/all-packages.nix+7
@@ -11126,6 +11126,13 @@ in
1112611126 julia-stable = julia_15;
1112711127 julia = julia-lts;
1112811128
11129+ julia_10-bin = callPackage ../development/compilers/julia/1.0-bin.nix { };
11130+ julia_16-bin = callPackage ../development/compilers/julia/1.6-bin.nix { };
11131+
11132+ julia-lts-bin = julia_10-bin;
11133+ julia-stable-bin = julia_16-bin;
11134+ julia-bin = julia-lts-bin;
11135+
1112911136 jwasm = callPackage ../development/compilers/jwasm { };
1113011137
1113111138 knightos-genkfs = callPackage ../development/tools/knightos/genkfs { };