Skip to content

Commit e9349eb

Browse files
committed
perf(nix): follow away fenix's 28 MB rust-analyzer-src
85% of what crane+fenix cost a downstream consumer was one transitive input devkit never chose. fenix pulls the rust-analyzer SOURCE TREE to build its *nightly* rust-analyzer derivation — which this pack never touches, because fromToolchainFile takes its components from the release-channel manifest instead. Following it to nixpkgs removes the node outright rather than replacing it, since every consumer already has nixpkgs. Lock nodes 15 -> 14, fetched source ~33 MB -> ~5 MB. Verified rather than reasoned about, because the obvious worry is that this breaks the rust-analyzer component: built a toolchain from filesender's rust-toolchain.toml (which lists rust-analyzer) with the follows in place, and result/bin contains rust-analyzer alongside cargo, clippy, rustfmt and rustc. filesender's full nix flake check stays green on all nine checks. Measured while spiking #1440, which also corrected a claim I had made about what these inputs cost. Deleting an unreferenced 20.8 MB input from the store and re-running each operation shows nix eval, flake show, flake check, flake metadata, develop and build all leave it absent; only flake archive and re-locking fetch it. So the recurring cost of a shared input is confined to nix flake update, not to everyday consumer operations. That measurement is on Nix 2.34.7+1 with fetch-tree and no lazy-trees; another Nix may differ, and CI images should be re-measured. This lands the part of #1440 that every reviewer agreed on regardless of how the larger question goes. Whether crane and fenix belong in devkit at all is still open there. Refs: #1440
1 parent f64240e commit e9349eb

2 files changed

Lines changed: 19 additions & 18 deletions

File tree

‎flake.lock‎

Lines changed: 3 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎flake.nix‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,22 @@
4848
# and the inputs can move out without a consumer-visible change.
4949
fenix.url = "github:nix-community/fenix";
5050
fenix.inputs.nixpkgs.follows = "nixpkgs";
51+
# fenix pulls the rust-analyzer SOURCE TREE — 28 MB, and 85% of everything
52+
# the two inputs above cost a downstream consumer. It feeds exactly one
53+
# thing: fenix's *nightly* rust-analyzer derivation, which this pack never
54+
# builds. `fromToolchainFile` takes its components from the release-channel
55+
# manifest instead, so following this away costs nothing — verified by
56+
# building filesender's toolchain (whose rust-toolchain.toml lists
57+
# rust-analyzer as a component) with the follows in place and finding
58+
# `rust-analyzer` present in the result.
59+
#
60+
# Pointed at nixpkgs because every consumer already has it, so the node
61+
# disappears from downstream locks rather than being replaced. Lock nodes:
62+
# 15 -> 14, fetched source ~33 MB -> ~5 MB.
63+
#
64+
# A consumer who genuinely wants fenix's nightly rust-analyzer must
65+
# override this back; nothing in devkit does. Refs #1440.
66+
fenix.inputs.rust-analyzer-src.follows = "nixpkgs";
5167
};
5268

5369
outputs =

0 commit comments

Comments
 (0)