How can we build a julia derivation with tests disabled

I tried based on this to deactivate the tests when building the julia-env derivation via overlay.

# ~/.config/nixpkgs/overlays/julia.nix 
self: super: {
  julia_11 = super.julia_11.overrideDerivation(oldAttrs: {
      doCheck = false;
    });
  arpack = super.arpack.overrideDerivation(oldAttrs: {
      doCheck = false;
    });
}

with this (usage: nix-build etc.):

# ~/.config/nixpkgs/program/julia/default.nix
with import <nixpkgs> { };
# somehow the let is eaten by the markdown parser
# let                                                                                                                                                                                                                 let
  extraLibs = [
    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_11 ] ++ extraLibs;
  phases = "installPhase";
  checkPhase = "true";
  installCheckPhase = "false";
  installPhase = ''
    export LD_LIBRARY_PATH=${lib.makeLibraryPath extraLibs}
    makeWrapper ${julia}/bin/julia $out/bin/julia \
        --prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH" \
        --set JULIA_PKGDIR $JULIA_PKGDIR
  '';
}

Can somebody help me how I do this right ?

Hey @573, the Nixpkgs’ Julia state is certainly awful, so I opened: Too many old Julia versions, 1.5 is not packaged, and all versions fail in tests · Issue #91930 · NixOS/nixpkgs · GitHub .

I tried to give a small effort to write a derivation for Julia 1.4 from scratch, and it proved to be rather difficult, because they don’t use Autoconf / cmake but a plain Makefile and that makes it pretty difficult as they also require Internet connection during the build. See:

https://github.com/JuliaLang/julia/issues/36604

@doronbehar I’m glad about your work, I think it is really pushing forward state of affairs.
Coming from and interested in a field of simulations in ecology I’m into nix already and have already explored the surface of how to handle things when it is coming to python, especially playing around in jupyter notebooks but to take one tiny step (on the shoulders of folks doing all the great detail work) towards julia would feel like a nice and rewarding progress for me.

The ticket #91930 mentions overriding (to no) tests. Is that something I should try until things are more usable, what do you think ?
Anyway thanks for reaching out!

I think you have to disable tests in order for getting at least an interpreter working, as the tests failing is what makes Julia not build on hydra nor anywhere else.

@doronbehar thanks, when I look at the nix file it seems that I had to set doCheck, but I read elsewhere that I have to use an overlay for that ?

Can you give an example maybe how this is done. What I have so far (references in comments) almost there I’d say is:

# ~/.config/nixpkgs/overlays/julia.nix 
self: super: {
  # https://stackoverflow.com/questions/57449098/nix-overlays-and-override-pattern/57548591#57548591
  # https://github.com/NixOS/nixpkgs/issues/70536#issuecomment-570946520 is using mkDerivation
  # https://github.com/NixOS/nixpkgs/issues/64416#issuecomment-511599552
  julia_11 = super.julia_11.overrideAttrs (oldAttrs: rec {
      doCheck = false;
      doInstallCheck = false;
    });
}

How would I make this work ? The tests (./runtests.jl) still are run.

Looking at postPatch in the original derivation maybe I can skip the touch calls after the removal of test files simply.