System with NixOS: how to add another extra distribution

If someone else eventually needs to patch the gksqt binary. Here is how you do it semi-automatically within a nix expression:

let 
 libPath = lib.makeLibraryPath [
    qt4 
    gcc9 
    stdenv.cc.cc.lib
  ];

in

  pkgs.stdenv.mkDerivation {
  name = "sandbox-julia";
  buildInputs = with pkgs; [
    julia
  ];
  shellHook = ''
    # Make sure the GR package is installed in the current project
    julia -e 'using Pkg; Pkg.activate("./"); Pkg.add("GR")'

  # Patch the GKS binary for GR
     patchelf \
     --set-interpreter ${glibc}/lib/ld-linux-x86-64.so.2 \
     --set-rpath "${libPath}" \
     /home/user/.julia/packages/GR/cRdXQ/deps/gr/bin/gksqt
'';
}

2 Likes