libfenix is fenix for cargo (libnix): the
Rust toolchains of the versions cargo (libnix) has releases for, each with the cargo (libnix) release of exactly that
version as its cargo. Everything else (rustc, rust-std, clippy, rustfmt, rust-src, rust-analyzer, …) is the rust-lang
dist component, packaged as fenix does.
It is a fork of fenix (MPL-2.0, kept); the toolchain packaging (lib/mk-toolchain.nix, lib/combine.nix) and the API
are fenix's, restricted to two pinned versions.
| attribute | rustc / dist manifest | cargo |
|---|---|---|
rust-1_87 |
1.87.0 (2025-05-15) | cargo (libnix) libnix-1.87.0+v5 |
rust-1_99, latest |
1.99.0 (2026-10-01) | cargo (libnix) libnix-1.99.0+v2 |
There are no channels (stable, beta, nightly) and no dated toolchains: a toolchain needs a cargo (libnix) release of its version. Other versions, dates or channels fail with an error naming the supported ones.
libfenix is meant to be temporary. It gives cargo (libnix) toolchains in a fenix shape while cargo (libnix) is young. Once cargo (libnix) gains more traction, the plan is to merge this work into upstream fenix, e.g. as a cargo (libnix) option for its toolchains, and to retire libfenix. The changes against fenix are listed in Differences to fenix.
As a flake:
{
inputs.libfenix.url = "github:nixcloud/libfenix";
outputs = { self, libfenix }: {
devShells.x86_64-linux.default = libfenix.devShells.x86_64-linux.rust-1_99;
packages.x86_64-linux.toolchain = libfenix.packages.x86_64-linux.rust-1_99.defaultToolchain;
};
}nix develop github:nixcloud/libfenix # 1.99, CARGO_BACKEND=nix
nix develop github:nixcloud/libfenix#rust-1_87Nothing is built: rustc and the other components come from static.rust-lang.org, cargo (libnix) from its nixcloud/cargo release, all patched for nix like fenix does.
Each toolchain set has what a fenix channel has:
- the components:
rustc(with rust-std),cargo(cargo (libnix)),clippy,rustfmt,rust-src,rust-analyzer, … toolchain(all components),minimalToolchain,defaultToolchain,completeToolchain(rustup's profiles)withComponents [ "rustc" "cargo" "rust-src" ]cargo-vanilla: the dist cargo of that versionversion("1.99.0"),libnixRelease("libnix-1.99.0+v2")
And as in fenix:
libfenix.toolchainOf { channel = "1.99"; } # or "1.99.0"
libfenix.fromToolchainFile { dir = ./.; } # rust-toolchain(.toml) with channel 1.87 or 1.99
libfenix.fromToolchainName { name = "1.87.0"; }
libfenix.combine [ libfenix.rust-1_99.rustc libfenix.rust-1_99.cargo libfenix.targets.wasm32-unknown-unknown.rust-1_99.rust-std ]The overlay adds pkgs.libfenix.
cargois cargo (libnix), prebuilt like the dist components: a release asset of nixcloud/cargo (cargo-<tag>-x86_64-unknown-linux-gnu.tar.xz, the dist cargo tarball with the cargo (libnix) binary), fetched, installed and patchelfed bylib/mk-toolchain.nix; nothing is compiled. Its rpath also has openssl and libgcc (it links libssl dynamically, the dist cargo statically), andcombinekeeps it a symlink (fenix'spatchelf --set-rpath $out/libwould drop that rpath)cargo.fromSourcebuilds the release from source: its generated nix build system with the dist rustc/cargo of the same version.cargo.assetpacks that build into the release asset (no RUNPATH, the FHS interpreter, no store paths), reproducibly, sonix build .#rust-1_99.cargo.assetgives the file the toolchain downloads- rustc ≥ 1.90 on x86_64-linux links with its own lld, past nix's ld wrapper (binaries without rpath). The combined
rustc/rustdocof these versions pass-C linker-features=-lld, as cargo (libnix) needs - x86_64-linux only: the release build systems were generated there, and cargo (libnix) is developed and tested there
- removed: the stable/beta/nightly channels,
fromManifest/fromManifestFile, rust-analyzer nightly and its vscode extension, the update bots
- a cargo (libnix) release of that version exists (
libnix-<version>+v<n>) - add its manifest hash to
updateand run it:data/<version>.json - add the release (tag, tarball hashes, cargo unit name,
assetSha256 = lib.fakeSha256) tolib/releases.nixand the version toversionsindefault.nix, and its attribute tolinesinflake.nixandupdate - run
updateagain: it builds the release asset from source, pins its hash inlib/releases.nixand prints where to upload it (the release of the tag on nixcloud/cargo, ascargo-<tag>-x86_64-unknown-linux-gnu.tar.xz) nix flake check
