From 6ed297d672c69612ab6d27c0ab8599a6846d9b9f Mon Sep 17 00:00:00 2001 From: Tee8z Date: Wed, 21 Oct 2026 09:56:21 -0400 Subject: [PATCH] build(nix): add llvm-tools to the development shell scripts/crap-report.sh runs cargo-llvm-cov, which needs the llvm-tools-preview component. The Nix shell installed only the components in rust-toolchain.toml, so the report failed there. The flake now adds llvm-tools-preview to those components. CI and rustup users still install only rust-toolchain.toml. --- docs/quality.md | 4 ++++ flake.nix | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/quality.md b/docs/quality.md index a5dc82a..a2efaee 100644 --- a/docs/quality.md +++ b/docs/quality.md @@ -190,6 +190,10 @@ cargo install knots --version 1.16.0 --locked --root .work/tools KNOTS_BIN=.work/tools/bin/knots scripts/crap-report.sh ``` +`cargo-llvm-cov` also needs the `llvm-tools-preview` toolchain component. The +`nix develop` shell includes it. With rustup, run +`rustup component add llvm-tools-preview` once. CI does not install it. + The script builds an instrumented binary and runs the whole test suite, which takes several minutes, and writes `crap.md` and `crap.json` below `target/crap/`. CI does not run it. Add meaningful tests or simplify risky code. Never game the score diff --git a/flake.nix b/flake.nix index cd32a22..2320e08 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,12 @@ inherit system; overlays = [ rust-overlay.overlays.default ]; }; - rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + # The pinned toolchain, plus llvm-tools for `scripts/crap-report.sh`. CI and + # rustup users install only the components in rust-toolchain.toml. + toolchain = (builtins.fromTOML (builtins.readFile ./rust-toolchain.toml)).toolchain; + rust = pkgs.rust-bin.fromRustupToolchain (toolchain // { + components = toolchain.components ++ [ "llvm-tools-preview" ]; + }); in { default = pkgs.mkShell { packages = [