at master 4.4 kB view raw
1{ 2 version, 3 sha256, 4 patches ? [ ], 5}: 6 7{ 8 autoPatchelfHook, 9 fetchurl, 10 lib, 11 stdenv, 12}: 13 14let 15 skip_tests = [ 16 # Test flaky on ofborg 17 "channels" 18 # Test flaky because of our RPATH patching 19 # https://github.com/NixOS/nixpkgs/pull/230965#issuecomment-1545336489 20 "compiler/codegen" 21 # Test flaky 22 "read" 23 ] 24 ++ lib.optionals (lib.versionAtLeast version "1.10") [ 25 # Test flaky 26 # https://github.com/JuliaLang/julia/issues/52739 27 "REPL" 28 # Test flaky 29 "ccall" 30 ] 31 ++ lib.optionals (lib.versionAtLeast version "1.11") [ 32 # Test flaky 33 # https://github.com/JuliaLang/julia/issues/54280 34 "loading" 35 "cmdlineargs" 36 ] 37 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 38 # Test flaky on ofborg 39 "FileWatching" 40 # Test requires pbcopy 41 "InteractiveUtils" 42 # Test requires network access 43 "Sockets" 44 ] 45 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ 46 # Test Failed at $out/share/julia/stdlib/v1.8/LinearAlgebra/test/blas.jl:702 47 "LinearAlgebra/blas" 48 # Test Failed at $out/share/julia/test/misc.jl:724 49 "misc" 50 ]; 51in 52stdenv.mkDerivation { 53 pname = "julia-bin"; 54 55 inherit version patches; 56 57 src = 58 { 59 x86_64-linux = fetchurl { 60 url = "https://julialang-s3.julialang.org/bin/linux/x64/${lib.versions.majorMinor version}/julia-${version}-linux-x86_64.tar.gz"; 61 sha256 = sha256.x86_64-linux; 62 }; 63 aarch64-linux = fetchurl { 64 url = "https://julialang-s3.julialang.org/bin/linux/aarch64/${lib.versions.majorMinor version}/julia-${version}-linux-aarch64.tar.gz"; 65 sha256 = sha256.aarch64-linux; 66 }; 67 x86_64-darwin = fetchurl { 68 url = "https://julialang-s3.julialang.org/bin/mac/x64/${lib.versions.majorMinor version}/julia-${version}-mac64.tar.gz"; 69 sha256 = sha256.x86_64-darwin; 70 }; 71 aarch64-darwin = fetchurl { 72 url = "https://julialang-s3.julialang.org/bin/mac/aarch64/${lib.versions.majorMinor version}/julia-${version}-macaarch64.tar.gz"; 73 sha256 = sha256.aarch64-darwin; 74 }; 75 } 76 .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); 77 78 postPatch = '' 79 # Julia fails to pick up our Certification Authority root certificates, but 80 # it provides its own so we can simply disable the test. Patching in the 81 # dynamic path to ours require us to rebuild the Julia system image. 82 substituteInPlace share/julia/stdlib/v${lib.versions.majorMinor version}/NetworkOptions/test/runtests.jl \ 83 --replace '@test ca_roots_path() != bundled_ca_roots()' \ 84 '@test_skip ca_roots_path() != bundled_ca_roots()' 85 ''; 86 87 nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ 88 autoPatchelfHook 89 # https://github.com/JuliaLang/julia/blob/v1.9.0/NEWS.md#external-dependencies 90 stdenv.cc.cc 91 ]; 92 93 installPhase = '' 94 runHook preInstall 95 cp -r . $out 96 '' 97 + lib.optionalString stdenv.hostPlatform.isLinux '' 98 # "$out/share" is intentionally omitted since it contains 99 # julia package images and patchelf would break them 100 autoPatchelf "$out/bin" "$out/lib" "$out/libexec" 101 '' 102 + '' 103 runHook postInstall 104 ''; 105 106 # Breaks backtraces, etc. 107 dontStrip = true; 108 dontAutoPatchelf = true; 109 110 doInstallCheck = true; 111 112 preInstallCheck = '' 113 export JULIA_TEST_USE_MULTIPLE_WORKERS=true 114 # Some tests require read/write access to $HOME. 115 # And $HOME cannot be equal to $TMPDIR as it causes test failures 116 export HOME=$(mktemp -d) 117 ''; 118 119 installCheckPhase = '' 120 runHook preInstallCheck 121 # Command lifted from `test/Makefile`. 122 $out/bin/julia \ 123 --check-bounds=yes \ 124 --startup-file=no \ 125 --depwarn=error \ 126 $out/share/julia/test/runtests.jl \ 127 --skip internet_required ${toString skip_tests} 128 runHook postInstallCheck 129 ''; 130 131 meta = { 132 description = "High-level, high-performance, dynamic language for technical computing"; 133 homepage = "https://julialang.org"; 134 # Bundled and linked with various GPL code, although Julia itself is MIT. 135 license = lib.licenses.gpl2Plus; 136 maintainers = with lib.maintainers; [ 137 raskin 138 nickcao 139 wegank 140 thomasjm 141 ]; 142 platforms = [ 143 "x86_64-linux" 144 "aarch64-linux" 145 "x86_64-darwin" 146 "aarch64-darwin" 147 ]; 148 mainProgram = "julia"; 149 }; 150}