Including latest Julia in configure.nix

Currently, even for the unstable channel, the version of Julia is only 1.3. I need the latest release 1.5.1.

The method is not so straight forward because of the FHS problem. And it is better to define the latest Julia package in configure.nix, which is a more nix way.

My method is basically following this post .

I copy the nix file of Julia 1.3 and change the corresponding lines (i.e., the file link and sha256). The patches of Julia 1.3 is also relavent. I just place the two patch files and the modified default.nix(originally 1.3.nix) in /etc/nixos/pkgs/julia_1_5/, and add a line in configure.nix.

Then by running sudo nixos-rebuild switch, the latest Julia is installed into my system-wise path.

One more thind I did is that I disabled the check in the default.nix.

related codes are placed here

2 Likes

Why do you copy the files instead of using overrideAttrs the corresponding attrs?

Because I have not yet learnt nix thoroughly, and don’t know the overrideAttrs method. I will have a try.
Thanks.

Or

let
  julia_latest = pkgs.julia_13.overrideAttrs(oldAttrs: {
   src = pkgs.fetchzip {
     url = "https://github.com/JuliaLang/julia/releases/download/v1.5.1/julia-1.5.1-full.tar.gz";
     sha256 = "sha256-uaxlzni2RtmDhMzPbtDycj44CB0tJUzhmbwsAGwFv/U=";
   };
   checkTarget = "";
  };

in
environment.systemPackages = with pkgs; [julia_lastest];

systemPkg

{
  (julia_13.overrideAttrs(oldAttrs: {
   src =pkgs.fetchzip {
     url = "https://github.com/JuliaLang/julia/releases/download/v1.5.1/julia-1.5.1-full.tar.gz";
     sha256 = "sha256-uaxlzni2RtmDhMzPbtDycj44CB0tJUzhmbwsAGwFv/U=";
   };
   checkTarget = "";
  });
})

  • julia overlay
self: super:
{
  julia_13 = super.julia_13.overrideAttrs(oldAttrs: {
   src = super.fetchzip {
     url = "https://github.com/JuliaLang/julia/releases/download/v1.5.1/julia-1.5.1-full.tar.gz";
     sha256 = "sha256-uaxlzni2RtmDhMzPbtDycj44CB0tJUzhmbwsAGwFv/U=";
   };
   checkTarget = "";
  });
}
2 Likes

I took a stab at adding 1.5 to nixpkgs a few days ago. I’ll submit a PR once I get it working!