Nix Channels

https://nixos.org/manual/nixpkgs/unstable/#overview-of-nixpkgs

Packages, including the Nix packages collection, are distributed through channels. The collection is distributed for users of Nix on non-NixOS distributions through the channel nixpkgs-unstable. Users of NixOS generally use one of the nixos-* channels, e.g. nixos-22.11, which includes all packages and modules for the stable NixOS 22.11. Stable NixOS releases are generally only given security updates. More up to date packages and modules are available via the nixos-unstable channel.

Both nixos-unstable and nixpkgs-unstable follow the master branch of the nixpkgs repository, although both do lag the master branch by generally a couple of days. Updates to a channel are distributed as soon as all tests for that channel pass, e.g. this table shows the status of tests for the nixpkgs-unstable channel.

  • nixpkgs-unstable: builds all packages for supported platforms.
  • nixos-*: builds all packages only for Linux.

See also Nix Channel Status.

Locales on non-NixOS Linux distros

https://nixos.wiki/wiki/Locales

On Rocky Linux, you should install glibc-all-langpacks, which provides the locale-archive file needed.

Without https://github.com/NixOS/nixpkgs/commit/de64f4939609ba9c258446eb17f9ec7425934f77, which the nixos-24.11 branch does not have, you also need to set LOCALE_ARCHIVE explicitly to avoid using the nixpkgs-bundled locale-archive with just C.UTF-8.

export LOCALE_ARCHIVE=/usr/lib/locale/locale-archive

Alternatively, you could install glibcLocales from nixpkgs and reference the symlink in your .nix-profile.

export LOCALE_ARCHIVE=~/.nix-profile/lib/locale/locale-archive # zsh expands ~ to $HOME

BEAM language packages

https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/top-level/all-packages.nix

  inherit (beam.interpreters)
    erlang erlang_27 erlang_26 erlang_25
    elixir elixir_1_18 elixir_1_17 elixir_1_16 elixir_1_15 elixir_1_14
    elixir-ls;
# ...
  beamPackages = dontRecurseIntoAttrs beam27Packages;
  beamMinimalPackages = dontRecurseIntoAttrs beamMinimal27Packages;
 
  beam25Packages = recurseIntoAttrs beam.packages.erlang_25;
  beam26Packages = recurseIntoAttrs beam.packages.erlang_26;
  beam27Packages = recurseIntoAttrs beam.packages.erlang_27;

https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/development/beam-modules/default.nix

      # BEAM-based languages.
      elixir = elixir_1_18;

https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/beam.section.md

All BEAM-related expressions are available via the top-level beam attribute, which includes:

  • interpreters: a set of compilers running on the BEAM, including multiple Erlang/OTP versions (beam.interpreters.erlang_22, etc), Elixir (beam.interpreters.elixir) and LFE (Lisp Flavoured Erlang) (beam.interpreters.lfe).
  • packages: a set of package builders (Mix and rebar3), each compiled with a specific Erlang/OTP version, e.g. beam.packages.erlang22.

The default Erlang compiler, defined by beam.interpreters.erlang, is aliased as erlang. The default BEAM package set is defined by beam.packages.erlang and aliased at the top level as beamPackages.

To create a package builder built with a custom Erlang version, use the lambda, beam.packagesWith, which accepts an Erlang/OTP derivation and produces a package builder similar to beam.packages.erlang.

Many Erlang/OTP distributions available in beam.interpreters have versions with ODBC and/or Java enabled or without wx (no observer support). For example, there’s beam.interpreters.erlang_22_odbc_javac, which corresponds to beam.interpreters.erlang_22 and beam.interpreters.erlang_22_nox, which corresponds to beam.interpreters.erlang_22.

elixir-ls

elixir-ls is built with the default elixir in BEAM modules. To use a different version of Elixir, you need to override it. For example:

packages.${system} = rec {
  erlang = pkgs.beam.interpreters.erlang_27;
  elixir = pkgs.beam.packages.erlang_27.elixir_1_18;
  elixir-ls =
    (pkgs.beam.packages.erlang_27.elixir-ls.override { inherit elixir; });
}

You may still need to install hex locally and run elixir-ls once to compile it.

mix local.hex
elixir-ls
# press Enter to quit

If you see the following error, configure locales per Locales on non-NixOS Linux distros.

warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell) or set the ELIXIR_ERL_OPTIONS="+fnu" environment variable

For Emacs, lsp-mode has lsp-elixir-server-command set to '("language_server.sh") by default, so you need to change that to elixir-ls, which is used to name the executable in nixpkgs.

References