git.iko.soy/typeable/nixpkgs
on master help sign in
julia: init julia_16-bin at 1.6.1

Relevant patches lifted from the `release-1.6` branch of my Julia fork: https://git.sr.ht/~ninjin/julia-nix/tree/release-1.6

commit351f9114b0b63eaa3d94e396330545e190774858 authorPontus Stenetorp <pontus@stenetorp.se> dateSat 24 Apr 2021, 15:42 (6 years ago) parentc58b976
5 files changed+162
pkgs/development/compilers/julia/1.6-bin.nix+73 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+4
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.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+4
@@ -11113,6 +11113,10 @@ in
1111311113 julia-stable = julia_15;
1111411114 julia = julia-lts;
1111511115
11116+ julia_16-bin = callPackage ../development/compilers/julia/1.6-bin.nix { };
11117+ julia-stable-bin = julia_16-bin;
11118+
11119+
1111611120 jwasm = callPackage ../development/compilers/jwasm { };
1111711121
1111811122 knightos-genkfs = callPackage ../development/tools/knightos/genkfs { };