Is asdf still the best way of install Elixir and Erlang on Linux?

If you’re already using Nix (or open to trying it), this is all you need in a flake.nix:

{
  inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  outputs = {nixpkgs, ...}: let
    systems = nixpkgs.lib.systems.flakeExposed;
  in {
    devShells = nixpkgs.lib.genAttrs systems (system: let
      pkgs = nixpkgs.legacyPackages.${system};
      beam-pkgs = pkgs.beam.packages.erlang_26;
    in {
      default = pkgs.mkShell {
        inherit (beam-pkgs) elixir erlang;
      };
    });
  };
}

Then nix develop and you’re done. Works the same on Linux and macOS.

13 Likes