Skip to content

Instantly share code, notes, and snippets.

@rbvermaa
Last active February 10, 2021 01:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbvermaa/08f916a63ba4f3f6123f97478309dfa0 to your computer and use it in GitHub Desktop.
Save rbvermaa/08f916a63ba4f3f6123f97478309dfa0 to your computer and use it in GitHub Desktop.
Julia Linux
let
pkgs = import <nixpkgs> {};
buildJulia = version: sha256:
with pkgs;
gcc7Stdenv.mkDerivation {
makeFlags = [
"ARCH=x86_64"
"MARCH=x86-64"
"JULIA_CPU_TARGET=x86-64"
"USE_BINARYBUILDER=0"
"PREFIX=$(out)"
"prefix=$(out)"
"OS=Linux"
];
name = "julia-${version}";
patches = [
(fetchurl {
url =
"https://raw.githubusercontent.com/NixOS/nixpkgs/9fa09748565e917f80db47006ecec48489cdb603/pkgs/development/compilers/julia/allow_nix_mtime.patch";
sha256 = "0r4zlrk1jxz0jghb3l0ry3lzqf0ddbp0c4s8qs1vhwk43b73w459";
})
];
src = pkgs.fetchzip {
url =
"https://github.com/JuliaLang/julia/releases/download/v${version}/julia-${version}-full.tar.gz";
inherit sha256;
};
enableParallelBuilding = true;
buildInputs = [ m4 python gfortran which perl ];
doCheck = false;
NIX_CFLAGS_COMPILE = if stdenv.isLinux then "-L${gfortran.cc.lib}/lib" else null;
separateDebugInfo = true;
preConfigure = ''
export PATH=$PATH:${cmake}/bin
sed -e '/^install:/s@[^ ]*/doc/[^ ]*@@' -i Makefile
sed -e '/[$](DESTDIR)[$](docdir)/d' -i Makefile
'';
};
in {
julia_142 = buildJulia "1.4.2" "14jghi9mw0wdi6y9saarf0nzary9i21jx43zznddzrq48v4nlayj";
}
@rbvermaa
Copy link
Author

I think the gcc7Stdenv was necessary due to compatibility with the BinaryBuilder artifacts that gets downloaded by the Julia package manager.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment