using elixir master branch using nix and nix-shell
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:
{ 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:
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