nixpkgs/pkgs/development/compilers/julia/1.0-bin.nix
Pontus Stenetorp 8949ae188a
julia: init julia_10-bin at 1.0.5
Almost as clean as it could be, but was forced to set `LD_LIBRARY_PATH`
to work around a `Libdl` failure that is unique to v1.0.x.
2021-05-16 14:12:37 +00:00

73 lines
2.3 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ autoPatchelfHook, fetchurl, lib, makeWrapper, openssl, stdenv }:
stdenv.mkDerivation rec {
pname = "julia-bin";
version = "1.0.5";
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 = "00vbszpjmz47nqy19v83xa463ajhzwanjyg5mvcfp9kvfw9xdvcx";
};
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
# Julias source files are in different locations for source and binary
# releases. Thus we temporarily create symlinks to allow us to share patches
# with source releases.
prePatch = ''
ln -s share/julia/stdlib/v${lib.versions.majorMinor version} stdlib
ln -s share/julia/test
'';
patches = [
# Source release Nix patch(es) relevant for binary releases as well.
./patches/1.0-bin/0002-nix-Skip-tests-that-require-network-access.patch
];
postPatch = ''
# Revert symlink hack.
rm stdlib test
'';
buildInputs = [ makeWrapper ];
nativeBuildInputs = [ autoPatchelfHook ];
installPhase = ''
runHook preInstall
cp -r . $out
# Setting `LD_LIBRARY_PATH` resolves `Libdl` failures. Not sure why this is
# only necessary on v1.0.x and a cleaner solution is welcome, but after
# staring at `strace` for a few hours this is as clean as I could make it.
wrapProgram $out/bin/julia \
--suffix LD_LIBRARY_PATH : $out/lib
runHook postInstall
'';
# Breaks backtraces, etc.
dontStrip = true;
doInstallCheck = true;
installCheckInputs = [ openssl ];
preInstallCheck = ''
# 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
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; [ ninjin raskin ];
platforms = [ "x86_64-linux" ];
};
}