> ## Content Index
> Fetch the complete content index at: https://til.codes/llms.txt
> Use this file to discover other available public pages before exploring further.

# using elixir master branch using nix and nix-shell
- URL: https://til.codes/using-elixir-master-branch-using-nix/
- Published: 2021-08-28T01:45:51.000Z
- Updated: 2021-08-28T01:45:51.000Z
- Author: Manu Ajith
- Tags: elixir, nix, #Import 2024-07-13 21:01

There were some noteable changes that landed on the master branch in elixir today, related to improving the compilation, and I wanted to try out the latest version of elixir that was on the master branch.

Since I use nix for setting up my projects, the latest version of elixir was not yet available as nix package. So I was looking into options on how I can use the latest master branch with nix-shell.

One option was to use override the package derivation and pin it to master branch, but after a bit more googling I went ahead with another option of using `overlays`

Here is how my nix-shell looks like:

```nix
{ sources ? import ./nix/sources.nix }:
with sources;

let
  project_name = "til_codes";
  pkgs = import sources.nixpkgs { overlays = [ (import ./nix/elixir.nix) ]; config = { }; };
  inherit (pkgs.lib) optional optionals;
in
pkgs.mkShell {
  buildInputs = with pkgs; [
    elixir
  ];
}

```

and `nix/elixir.nix` as follows:

```nix
self: super: {
  elixir = (super.beam.packagesWith super.erlang).elixir.override {
    src = builtins.fetchGit {
      url = "https://github.com/elixir-lang/elixir";
      ref = "master";
    };
    minimumOTPVersion = "22";
  };
}

```

The advantage of using overlays over overrides is that overlays can be further customised if needed.

Hope that helps someone