I’m trying to install Elixir 1.15 compiled against latest available Erlang, e.g. 26.1.2.
How do I do that? Is it possible to customise the unstablePkgs.elixir
line to say “Please, make sure to install a version of erlang that’s unstablePkgs.erlang_26
”?
My flake.nix
looks like this:
{
inputs = {
nixpkgs = {
url = "nixpkgs/nixos-23.05";
};
unstable = {
url = "nixpkgs/nixos-unstable";
};
};
outputs = { self, nixpkgs, unstable }: {
packages."x86_64-darwin".default = let
pkgs = nixpkgs.legacyPackages."x86_64-darwin";
unstablePkgs = unstable.legacyPackages."x86_64-darwin";
in pkgs.buildEnv {
name = "my-packages";
paths = with pkgs; [
curl
git
unstablePkgs.elixir
unstablePkgs.erlang_26
];
};
};
}
If I run:
nix --extra-experimental-features 'nix-command flakes' build
I get this output when running interpreters - note the different erts
versions - 14.1.1 corresponds to OTP 26:
$ result/bin/elixir --version
Erlang/OTP 25 [erts-13.2.2.4] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1]
Elixir 1.15.7 (compiled with Erlang/OTP 25)
$ result/bin/erl -version
Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 14.1.1
I’m using an Intel-based MacBook. This is my second attempt to get into Nix world. This time my motivation aligns with that of Julia Evan’s blog post, e.g. replacing Homebrew, a package manager I’ve used for many years, with a simple Nix flake.