Nix and nixpkgs API documentation
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 thenixos-*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 thenixos-unstablechannel.Both
nixos-unstableandnixpkgs-unstablefollow themasterbranch of the nixpkgs repository, although both do lag themasterbranch 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 thenixpkgs-unstablechannel.
- 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-archiveAlternatively, you could install glibcLocales from nixpkgs and reference the symlink in your .nix-profile via .zshenv.
export LOCALE_ARCHIVE=~/.nix-profile/lib/locale/locale-archive # zsh expands ~ to $HOMETerminfo on non-NixOS Linux distros
Similarly, you may also need to export TERMINFO_DIRS in .zshenv.
export TERMINFO_DIRS=/usr/share/terminfoBEAM 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
beamattribute, 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 aserlang. The default BEAM package set is defined bybeam.packages.erlangand aliased at the top level asbeamPackages.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 tobeam.packages.erlang.Many Erlang/OTP distributions available in
beam.interpretershave versions with ODBC and/or Java enabled or without wx (no observer support). For example, there’sbeam.interpreters.erlang_22_odbc_javac, which corresponds tobeam.interpreters.erlang_22andbeam.interpreters.erlang_22_nox, which corresponds tobeam.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 “install the ElixirLS release” locally.
mix local.hex
elixir-ls
# press Enter to quitIf 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.
Ad hoc commands
Image conversion and compression examples:
nix run -- nixpkgs#imagemagick identify a.png
nix run -- nixpkgs#imagemagick a.png a.jpg
 
nix run -- nixpkgs#oxipng -o 4 --strip safe --alpha a.png