Skip to content

Instantly share code, notes, and snippets.

@tbenst
Created February 23, 2019 17:46
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbenst/7c33680b5bac66a2a758827655517ea4 to your computer and use it in GitHub Desktop.
Save tbenst/7c33680b5bac66a2a758827655517ea4 to your computer and use it in GitHub Desktop.
use with `nix-shell julia-shell.nix`
with import <nixpkgs> {};
let
d = version: "v${lib.concatStringsSep "." (lib.take 2 (lib.splitString "." version))}";
extraLibs = [
# IJulia.jl
mbedtls
zeromq3
# ImageMagick.jl
imagemagickBig
# HDF5.jl
hdf5
# Cairo.jl
cairo
gettext
pango.out
glib.out
# Gtk.jl
gtk3
gdk_pixbuf
# GZip.jl # Required by DataFrames.jl
gzip
zlib
# GR.jl # Runs even without Xrender and Xext, but cannot save files, so those are required
xorg.libXt
xorg.libX11
xorg.libXrender
xorg.libXext
glfw
freetype
];
in
stdenv.mkDerivation rec {
name = "julia-${version}-env";
version = julia.version;
nativeBuildInputs = [ makeWrapper cacert git pkgconfig which ];
buildInputs = [
julia
] ++ extraLibs;
phases = [ "installPhase" ];
installPhase = ''
export LD_LIBRARY_PATH=${lib.makeLibraryPath extraLibs}
if [ ! -d $JULIA_PKGDIR/${d version}/METADATA ]; then
julia -e "Pkg.init()"
# else
# julia -e "Pkg.update()"
fi
pushd $JULIA_PKGDIR/${d version}
makeWrapper ${julia}/bin/julia $out/bin/julia \
--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH" \
--set JULIA_PKGDIR $JULIA_PKGDIR
# --set JULIA_LOAD_PATH $JULIA_PKGDIR/${d version}
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment