Erlang on Nix/NixOS

Philip Stears philip@REDACTED
Fri Apr 3 15:56:58 CEST 2020


Hi All,

This may be of interest to folks that are using Nix or NixOS.

I've created a nix overlay that (I think) makes it easy to get a specific version of Erlang into a nix environment.

The reason being, that we've adopted nix for our build environments, and prior to nix, most of us used kerl to manage different Erlang versions - and the Erlang derivations available in nixpkgs don't give us the same level of control.

With the overlay, one can create a shell.nix which imports a specific version, e.g.

let
  erlangReleases =
    import (builtins.fetchTarball https://github.com/nixerl/nixpkgs-nixerl/archive/v1.0.4-devel.tar.gz);

  nixpkgs =
    import <nixpkgs> { overlays = [ erlangReleases ]; };

in
  with nixpkgs;
  mkShell {
    buildInputs = with pkgs; [

      # Provide Erlang 22.2
      nixerl.erlang-22-2.erlang

      # Provide the nixpkgs version of Rebar3 built using Erlang 22.2
      nixerl.erlang-22-2.rebar3
    ];
  }

The overlay is available on GitHub at https://github.com/nixerl/nixpkgs-nixerl along with a description of what it is, how it works, etc.

It has the relevant metadata for all versions of Erlang starting from 18.

I hope others find it useful too!

Philip Stears
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20200403/83f61efa/attachment.htm>


More information about the erlang-questions mailing list