Change Elixir version in overlay

I’m running version 18.03 (Impala) and been trying to set up a basic Elixir environment on my machine.

I’ve just took a look at the Nixpkgs sections on Overlays and decided to try it, this is my following config:

self: super:

{
  # .NET Core SDK (works fine)
  dotnet-sdk = super.dotnet-sdk.overrideAttrs (oldAttrs : rec {
    version = "2.1.401";
    name = "dotnet-sdk-${version}";
    src = super.fetchurl {
      url = "https://download.microsoft.com/download/E/8/A/E8AF2EE0-5DDA-4420-A395-D1A50EEFD83E/dotnet-sdk-2.1.401-linux-x64.tar.gz";
      sha512 = "639f9f68f225246d9cce798d72d011f65c7eda0d775914d1394df050bddf93e2886555f5eed85a75d6c72e9063a54d8aa053c64c326c683b94e9e0a0570e5654";
    };
  });

  # Elixir Environment
  elixir = super.elixir.overrideAttrs (oldAttrs : rec {
    version = "1.7.3";
    sha256 = "0d7rj4khmvy76z12njzwzknm1j9rhjadgj9k1chjd4gnjffkb1aa";
    minimumOTPVersion = "19";
  });
}

and this is the generic builder for elixir I’ve been trying to overlay.

It seems that instead of downloading the latest version (1.7.3) I keep getting the current default (1.6.2).

Any hints on what might be causing this? I’m a beginner with NixOS.


Really like to thank @Mic92 and @lheckemann for helping me out.

The following changes were also needed in order for it to build 1.7.2+ successfully, not sure if harmless or it will break something later, but basic stuff seems to work.

    preBuild = ''
      # The build process uses ./rebar. Link it to the nixpkgs rebar
      rm -v rebar
      ln -s ${rebar}/bin/rebar rebar
      substituteInPlace Makefile \
        --replace "/usr/local" $out
    '';

to

    preBuild = ''
      substituteInPlace Makefile \
        --replace "/usr/local" $out
    '';

You need to overwrite src.

super.elixir.overrideAttrs (old: { name = "elixir-1.7.3"; src = fetchFromGitHub {  rev = "v1.7.3"; sha256 = "0d7rj4khmvy76z12njzwzknm1j9rhjadgj9k1chjd4gnjffkb1aa"; owner = "elixir-lang"; repo = "elixir"; }; })
1 Like

Thanks! :smiley:

I’m kinda curious on why super.fetchFromGithub says its missing while super.fetchgit works fine.

Iirc it’s called fetchFromGitHub not fetchFromGithub — just some confusion with case I believe :slight_smile:

2 Likes

Wow thanks, that would be quite hard to notice! :sweat_smile: