Repository navigation
Tags
Tags
libnix-1.99.0+v5 `cargo --version`: cargo 1.99.0 +libnix v5. Changes since libnix-1.99.0+v4: - Output links like legacy mode: written for every root unit from the paths cargo computes, not from fixed name patterns. A --target build gets target/<triple>/<profile>/ (it replaced the host binary's link before), a wasm32 binary its .wasm, cdylibs (libfoo.so, foo.wasm) and staticlibs a link at all. - --message-format=json: a compiler-artifact per root unit, with the linked files, and build-finished. trunk and wasm-pack read the .wasm from them, so `trunk build` and `trunk serve` work in nix mode. Not yet: the units of dependencies and the rustc diagnostics (compiler-message). - The nixcloud banner and the backend line are on stderr. On stdout they ended up before the JSON of `cargo metadata` and --message-format=json, and in the output of `cargo run`. - `[env]` paths with `relative = true` that the build sandbox can't provide are told in a note below the errors of a failed build (and with -v), not on every build. No note for variables nix mode drops (cargo's own CARGO_RUSTC_CURRENT_DIR) and for the workspace root (CARGO_WORKSPACE_DIR). - `Compiling` lines show the kind of a unit in grey: libc (build.rs run). - tests-libnix/cross reads the binaries where legacy mode has them, and fails if a cross build writes target/debug. The bins of the workspace rebuild once ($out/bin/<name>). build-rs-libnix is still 0.1.17. Known limits: glibc targets other than the host need a cross C toolchain; a rustc-link-search into the sources of the crate itself (stm32-metapac's device.x) is gone after the build script run. Tests (2026-12-04): test.nix: all 31 projects pass with rustc 1.99.0, with --release added to the cargo flags; tests-libnix/gc, cross, link-search and env pass. trunk build and trunk serve of ka4h2 (Leptos, wasm32).
libnix-1.87.0+v8 `cargo --version`: cargo 1.87.0 +libnix v8. Changes since libnix-1.87.0+v7: - Output links like legacy mode: written for every root unit from the paths cargo computes, not from fixed name patterns. A --target build gets target/<triple>/<profile>/ (it replaced the host binary's link before), a wasm32 binary its .wasm, cdylibs (libfoo.so, foo.wasm) and staticlibs a link at all. - --message-format=json: a compiler-artifact per root unit, with the linked files, and build-finished. trunk and wasm-pack read the .wasm from them, so `trunk build` and `trunk serve` work in nix mode. Not yet: the units of dependencies and the rustc diagnostics (compiler-message). - The nixcloud banner and the backend line are on stderr. On stdout they ended up before the JSON of `cargo metadata` and --message-format=json, and in the output of `cargo run`. - `[env]` paths with `relative = true` that the build sandbox can't provide are told in a note below the errors of a failed build (and with -v), not on every build. No note for variables nix mode drops (cargo's own CARGO_RUSTC_CURRENT_DIR) and for the workspace root (CARGO_WORKSPACE_DIR). - `Compiling` lines show the kind of a unit in grey: libc (build.rs run). - tests-libnix/cross reads the binaries where legacy mode has them, and fails if a cross build writes target/debug. The bins of the workspace rebuild once ($out/bin/<name>). build-rs-libnix is still 0.1.17. Known limits: glibc targets other than the host need a cross C toolchain; a rustc-link-search into the sources of the crate itself (stm32-metapac's device.x) is gone after the build script run. Tests (2026-12-04): test.nix: all 30 projects pass with rustc 1.87.0, with --release added to the cargo flags; tests-libnix/gc, cross, link-search and env pass.
libnix-1.99.0+v4
`cargo --version`: cargo 1.99.0 +libnix v4.
Changes since libnix-1.99.0+v3:
- Build script errors: what build-rs-libnix reports (the script's output
with the failing line marked) is shown by `cargo build`. It went to the
nix log only.
- build-rs-libnix 0.1.17 (was 0.1.14):
- `cargo:rustc-link-search` without a kind (cortex-m-rt, embedded
projects), and directories below OUT_DIR keep their path
- `cargo:rustc-link-arg-bins`, for the bin targets of the package only
- `links` metadata with empty values and any key: aws-lc-sys, so rustls
with its default crypto provider builds
- environment variables are safe to source (`'` in a value), and the key
of `cargo:rustc-env` ends at the first `=`
- `[env]` of .cargo/config.toml with `relative = true`: a path below the
workspace root is available in the build sandbox, as a store path of its
own; other paths are left as they are, with a warning. Every unit gets
the variable, as with cargo, so changing such a file rebuilds all units.
- Cargo.dependencies.nix: `build_rs_libnix`, a build-rs-libnix of its own,
e.g. a vendored checkout with a fix that isn't released.
- Status line: the counters are in color. `fresh` is gone from the summary,
it counted two internal derivations, never a crate.
- Tests: tests-libnix/link-search and tests-libnix/env.
Build script runs and what depends on them rebuild once: build-rs-libnix
changed.
Known limits: a rustc-link-search into the sources of the crate itself
(stm32-metapac's device.x) is gone after the build script run, so its
linker script isn't found. Cross compiling is as before: glibc targets
other than the host fail, outputs are linked to target/<profile>.
Tests (2026-11-24): test.nix: all 31 projects pass with rustc 1.99.0, with
--release added to the cargo flags; tests-libnix/gc, cross, link-search
and env pass. nixcloud.auth builds and passes its NixOS VM test.
libnix-1.87.0+v7
`cargo --version`: cargo 1.87.0 +libnix v7.
Changes since libnix-1.87.0+v6:
- Build script errors: what build-rs-libnix reports (the script's output
with the failing line marked) is shown by `cargo build`. It went to the
nix log only.
- build-rs-libnix 0.1.17 (was 0.1.14):
- `cargo:rustc-link-search` without a kind (cortex-m-rt, embedded
projects), and directories below OUT_DIR keep their path
- `cargo:rustc-link-arg-bins`, for the bin targets of the package only
- `links` metadata with empty values and any key: aws-lc-sys, so rustls
with its default crypto provider builds
- environment variables are safe to source (`'` in a value), and the key
of `cargo:rustc-env` ends at the first `=`
- `[env]` of .cargo/config.toml with `relative = true`: a path below the
workspace root is available in the build sandbox, as a store path of its
own; other paths are left as they are, with a warning. Every unit gets
the variable, as with cargo, so changing such a file rebuilds all units.
- Cargo.dependencies.nix: `build_rs_libnix`, a build-rs-libnix of its own,
e.g. a vendored checkout with a fix that isn't released.
- Status line: the counters are in color. `fresh` is gone from the summary,
it counted two internal derivations, never a crate.
- Tests: tests-libnix/link-search and tests-libnix/env.
Build script runs and what depends on them rebuild once: build-rs-libnix
changed.
Known limits: a rustc-link-search into the sources of the crate itself
(stm32-metapac's device.x) is gone after the build script run, so its
linker script isn't found. Cross compiling is as before: glibc targets
other than the host fail, outputs are linked to target/<profile>.
Tests (2026-11-24): test.nix: all 30 projects pass with rustc 1.87.0, with
--release added to the cargo flags; tests-libnix/gc, cross, link-search
and env pass.
libnix-1.99.0+v3 `cargo --version`: cargo 1.99.0 +libnix v3. Changes since libnix-1.99.0+v2: - Cross compiling: `CARGO_BACKEND=nix cargo build --target <triple>` adds the rust-std of each --target to the units' rustc, from the same manifest. Before, it failed with "can't find crate for `std`". A target spec file (.json) is refused with an error, it has no std from fenix. - The units' rustc wraps its bundled ld.lld with nixpkgs' ld-wrapper.sh instead of passing -C linker-features=-lld, which is an error with any target other than x86_64-unknown-linux-gnu. Binaries keep their rpaths, e.g. for openssl. Generated build systems rebuild: the rustc derivation changed. - tests-libnix/cross/run.sh: two workspaces, a hello and a C library compiled for the target by its build script, built for x86_64-unknown-linux-gnu, x86_64/i686/aarch64/armv7/riscv64gc musl, wasm32-wasip1 and wasm32-unknown-unknown, checked and run natively, with qemu-user or wasmtime. - flake.nix of this branch: libnix-1.99.0+v2 as generator, the 1.87 toolchain and cargo-libnix-git-revision-via-ifd are gone. The releases of every line are on master-libnix. - README: cross compiling, libfenix, cargo check and IDEs, project_src. Known limits: aarch64-unknown-linux-gnu and other glibc targets need a cross C toolchain in the units' build environment and still fail. Outputs of cross builds are linked to target/debug, not target/<triple>/debug. The aarch64, armv7, i686 and riscv64 musl targets need CARGO_TARGET_<TRIPLE>_LINKER=rust-lld. Tests: test.nix: all 31 projects pass with rustc 1.99.0, with --release added to the cargo flags; tests-libnix/gc/run.sh and tests-libnix/cross/run.sh pass (2026-11-06).
libnix-1.87.0+v6 `cargo --version`: cargo 1.87.0 +libnix v6. Changes since libnix-1.87.0+v5: - Cross compiling: `CARGO_BACKEND=nix cargo build --target <triple>` adds the rust-std of each --target to the units' rustc, from the same manifest. Before, it failed with "can't find crate for `std`". A target spec file (.json) is refused with an error, it has no std from fenix. Without --target the rustc is the same as before. - tests-libnix/cross/run.sh: two workspaces, a hello and a C library compiled for the target by its build script, built for x86_64-unknown-linux-gnu, x86_64/i686/aarch64/armv7/riscv64gc musl, wasm32-wasip1 and wasm32-unknown-unknown, checked and run natively, with qemu-user or wasmtime. - test.nix: union is gone, it needs a nightly rustc. - flake.nix of this branch: libnix-1.87.0+v5 as generator. - README: cross compiling, libfenix, cargo check and IDEs, project_src. Known limits: aarch64-unknown-linux-gnu and other glibc targets need a cross C toolchain in the units' build environment and still fail. Outputs of cross builds are linked to target/debug, not target/<triple>/debug. The aarch64, armv7, i686 and riscv64 musl targets need CARGO_TARGET_<TRIPLE>_LINKER=rust-lld. Tests: test.nix: all 30 projects pass with rustc 1.87.0, with --release added to the cargo flags; tests-libnix/gc/run.sh and tests-libnix/cross/run.sh pass (2026-11-06).
libnix-1.99.0+v2 `cargo --version`: cargo 1.99.0 +libnix v2. Changes since libnix-1.99.0+v1: - Git dependencies come from cargo's own checkout, added to the store as the fetchgit output: no nix-prefetch-git, no second download on every build (#10). fetchgit with submodules is made deterministic on nixpkgs 26.05 (detached git maintenance raced the .git removal). - cargo --version shows the libnix release (LIBNIX_RELEASE, #30): `cargo 1.99.0 +libnix v2`, `libnix: 1.99.0+v2` in `cargo -vV`. - The workspace's path crates share one src, configurable with project_src.include/exclude; the build script run derivations no longer contain an absolute path (a different output directory rebuilt them). - Faster generation and evaluation: cargo_build_caller.nix is evaluated once instead of once per attribute, nix mode skips cargo's legacy fingerprints, the handlebars templates are parsed once, and the lib of a build script run comes from a map (cargo: ~736 -> ~596 ms). - Timings after every build: generation, evaluation, build, other and the total. - build-rs-libnix 0.1.14: the `cargo::` build script syntax (Rust >= 1.77, e.g. blake3's cargo::rustc-cfg) next to `cargo:`. - GC roots: what a build no longer uses is deleted, also the outputs of failed or interrupted builds and what was still in use (the cargo binary that builds its successor), by the next successful build (a file `built` per selection). build-rs-libnix is retained when there are build script runs. tests-libnix/gc/run.sh tests it. Tests: cargo builds itself with CARGO_BACKEND=nix; `cargo test --lib nix_build` passes; test.nix: all 31 projects pass with rustc 1.99.0 (2026-10-27).
libnix-1.87.0+v5 `cargo --version`: cargo 1.87.0 +libnix v5. Changes since libnix-1.87.0+v4: - The toolchain is a pinned rustc 1.87.0 without rust-src (it ended up in the runtime closure of every binary). - build-rs-libnix 0.1.14 from nixcloud/build-rs-libnix (shared with the 1.99 line): cargo:rustc-link-arg (tikv-jemalloc-sys) and the `cargo::` build script syntax next to `cargo:`. The unused crates.io dependency on build-rs-libnix is gone. - Git dependencies come from cargo's own checkout, added to the store as the fetchgit output: no nix-prefetch-git, no second download on every build (#10). fetchgit with submodules is made deterministic on nixpkgs 26.05. - cargo --version shows the libnix release (LIBNIX_RELEASE, #30). - The workspace's path crates share one src, configurable with project_src.include/exclude; the build script run derivations no longer contain an absolute path (fixes the known issue of v4: a different output directory rebuilt them and their dependents). - Large dependency graphs: the library closure of a unit is computed with builtins.genericClosure (the recursion took over 70 minutes for union's ~1700 units). - Faster generation and evaluation: cargo_build_caller.nix is evaluated once instead of once per attribute, no legacy fingerprints, the handlebars templates are parsed once, the lib of a build script run comes from a map. Timings after every build. - GC roots: what a build no longer uses is deleted, also the outputs of failed or interrupted builds and what was still in use (the cargo binary that builds its successor), by the next successful build. build-rs-libnix is retained when there are build script runs. - README: build scripts and build-rs-libnix, commercial support, the link to the 1.99 line. Tests: test.nix: 30 of 31 projects pass with rustc 1.87.0 (union needs a nightly rustc); tests-libnix/gc/run.sh passes.
libnix-1.99.0+v1
The first release of the Rust 1.99.0 line: the libnix patch stack of
libnix-1.87.0+v4, squashed and ported onto upstream's rust-1.99.0
(cargo 0.100.0). `cargo --version`: cargo 1.99.0 +libnix.
Changes since libnix-1.87.0+v4:
- Rust 1.99.0: ported to upstream's new layout (src/cargo/* -> src/*) and
APIs (UserIntent/CompileMode, the removed build plan, FxHash collections,
load_overlaid, a Sync GlobalContext). The generated build system pins
rustc/cargo 1.99.0 from fenix, without rust-src.
- rustc >= 1.90 links with its bundled lld, which bypasses nix's linker
wrapper (no rpath, failing posix_spawnp). The units are built with a
wrapped rustc/rustdoc passing `-C linker-features=-lld`, so they link
through the cc/ld wrapper again.
- Large dependency graphs: the library closure of a unit is computed with
builtins.genericClosure (the recursion was exponential, minutes to hours
of evaluation for ~1500 units), and rustc-linker-arguments-dir reads its
libraries from a file (passAsFile) instead of one argument, which hit
the 128 KiB limit ("Argument list too long").
- build scripts: build-rs-libnix 0.1.12 from nixcloud/build-rs-libnix
(shared with the 1.87 line), with cargo:rustc-link-arg support
(tikv-jemalloc-sys). The unused crates.io dependency on build-rs-libnix
is gone. Not supported yet: the `cargo::` syntax, generic metadata,
rustc-flags and the target-specific rustc-link-arg-* (see README).
- project_root of cargo_build_caller.nix is relative to the actual target
directory (CARGO_TARGET_DIR).
- From the 1.87 line since v4: the toolchain without rust-src, the
commercial support notice.
- Branches: master-libnix is the 1.99 line now (= rust-1.99.0-libnix);
the 1.87 line continues as rust-1.87.0-libnix.
Tests: cargo builds itself with CARGO_BACKEND=nix; `cargo test --lib
nix_build` passes; test.nix: all 31 projects pass with rustc 1.99.0,
among them xai-org/grok-build (~1600 units) and rust-analyzer 2026-10-19
(union was removed, it needs a nightly rustc).
libnix-1.87.0+v4
Changes since libnix-1.87.0+v3:
- cargo test (unit, integration and doc tests): test harnesses and
examples are built in nix like binaries, from target/<profile>/nix-test
with GC roots of their own, and run on the host like with cargo
(legacy), with the same output. OUT_DIR, rustc-env, CARGO_BIN_EXE_<name>
and the binaries next to integration tests work; doc tests use the
rustdoc and linker the units were built with, so the host needs no
toolchain. env!("CARGO_MANIFEST_DIR") points at the (read-only) sources
in the store.
- cargo run: binaries and examples, with the arguments, exit code,
working directory, OUT_DIR and rustc-env of cargo (legacy).
std::env::current_exe() is the binary in the store.
- cargo install / cargo uninstall: installed binaries stay in the store
(they link against store paths), each rooted by an indirect GC root in
<root>/nix/install/<pkg>-<version>-<hash>/<bin>; <root>/bin links to
them through that root. crates.io packages are fetched into the store
like dependencies. After every install and uninstall, roots no bin/
link uses anymore (uninstalled, replaced by another version) are
removed and their store paths deleted unless something else still uses
them. Crate sources and builds are left to nix-collect-garbage.
- GC roots for everything a build uses (#4): the generated build system
lists every unit output, crate tarball, the toolchain and the external
dependencies; the list is rooted in target/<profile>/nix/gc, so
nix-collect-garbage no longer removes dependency builds. After a build,
what the previous build used and the new one doesn't is deleted through
the nix-daemon, unless something else still uses it ("Removed N unused
store path(s), <size>"). Each selection of root units (cargo build,
cargo run --bin a, cargo test -p x, other features) has a slot of its
own, so building a subset doesn't delete what the full build uses; the
8 most recently built selections are kept.
- cargo clean works in nix mode: removes the target dir (or a profile)
and deletes the store paths its builds rooted, unless used elsewhere;
--dry-run counts them. cargo clean -p and cargo clean gc stay
unsupported.
- Build failures are printed at the end, each under a header naming the
crate and its derivation, instead of interleaved with other builds
(also with --keep-going and after Ctrl-C).
- Git dependencies: fixed a panic for git dependencies outside
~/.cargo/git/checkouts (vendored sources, source replacement), and git
crates are built in a writable copy of their repository instead of the
read-only store (also fixes crates in a subdirectory of their
repository).
- Regression tests (#18): test.nix builds 31 real-world projects at
pinned revisions with the cargo (libnix) of the checkout (IFD) and runs
their binaries; tests-libnix/run.sh builds them one by one with
--keep-going and writes RESULTS.md. 23 pass, the other 8 need a rustc
newer than 1.87.
- flake.nix: cargo-libnix-git-head-via-ifd (the working tree) and
cargo-libnix-git-revision-via-ifd (a pinned revision) build cargo
(libnix) from source via IFD through a shared buildCargoBin { src };
cargo_1_87_vanilla_pin is exported.
- README: supported subcommands and features, how it works,
requirements, a copy-pasteable shell.nix, exporting the build system
for your own project, branches and releases.
Known issue: the absolute path of the generated .nix file leaks into
build script run derivations, so a different output directory (a new
temporary dir of cargo install, the IFD output) rebuilds them and their
dependents.
PreviousNext