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