Skip to content

Instantly share code, notes, and snippets.

@idontgetoutmuch
Created May 29, 2020 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idontgetoutmuch/c3a85b52c725c72ecfdcea6744017883 to your computer and use it in GitHub Desktop.
Save idontgetoutmuch/c3a85b52c725c72ecfdcea6744017883 to your computer and use it in GitHub Desktop.
{pkgs, stdenv, ...}:
with pkgs;
let
julia = julia_11;
d = version: "v${lib.concatStringsSep "." (lib.take 2 (lib.splitString "." version))}";
extraLibs = [
# ImageMagick.jl ==========================
imagemagickBig
# HDF5.jl =================================
hdf5
# Sundials.jl =================================
sundials
# Cairo.jl ================================
cairo gettext pango.out glib.out
# Gtk.jl ==================================
gtk3 gdk_pixbuf
# GZip.jl required by DataFrames.jl =======
gzip zlib
# GR.jl which runs without Xrender & Xext =
# but cannot save files ===================
xorg.libXt xorg.libX11 xorg.libXrender xorg.libXext glfw freetype
# Flux.jl =================================
cudatoolkit linuxPackages.nvidia_x11 git gitRepo gnupg autoconf curl
procps gnumake utillinux m4 gperf unzip libGLU_combined ncurses5 stdenv.cc binutils
xorg.libXi xorg.libXmu freeglut xorg.libXext xorg.libX11 xorg.libXv xorg.libXrandr zlib
# Arpack.jl ===============================
arpack gfortran.cc
(pkgs.runCommand "openblas64_" {} ''
mkdir -p "$out"/lib/
ln -s ${openblasCompat}/lib/libopenblas.so "$out"/lib/libopenblas64_.so.0
'')
];
in
stdenv.mkDerivation rec {
name = "julia-env";
version = julia.version;
nativeBuildInputs = [ makeWrapper cacert git pkgconfig which ];
buildInputs = [
julia
/* jupyterEnv # my custom jupyter */
] ++ extraLibs;
phases = [ "installPhase" ];
installPhase = ''
export CUDA_PATH="${cudatoolkit}"
export LD_LIBRARY_PATH=${lib.makeLibraryPath extraLibs}
# pushd $JULIA_PKGDIR/${d version}
makeWrapper ${julia}/bin/julia $out/bin/julia \
--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH" \
--prefix LD_LIBRARY_PATH ":" "${linuxPackages.nvidia_x11}/lib" \
--set CUDA_PATH "${cudatoolkit}" \
--set JULIA_PKGDIR $JULIA_PKGDIR
'';
}
{ nixpkgs ? import <nixpkgs> {
config.allowUnfree = true;
overlays = [ ]; } } :
nixpkgs.callPackage ./default.nix {
pkgs = nixpkgs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment