Skip to content

Commit cf96009

Browse files
authored
devenv: Install pinned nightly Rust toolchain via rustup (#122)
I want to start using `cargo fuzz`; it requires a nightly toolchain per https://rust-fuzz.github.io/book/cargo-fuzz/setup.html Pin to a version that gets renovate-bumped. (In the future I'd like to CI gate that our devenv works on some representative projects) Renovate is configured to track new nightlies via a custom datasource that reads the official Rust release manifest (manifests.txt), using the rust-release-channel versioning scheme. This is the same data source the upcoming native rust-version datasource will use (renovatebot/renovate#39529); once that merges this custom config can be replaced with zero-config native support. Tested: `podman run <image> cargo +nightly --version` succeeds in the resulting c10s container image. Assisted-by: OpenCode (Claude claude-opus-4-6) Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 6acb50f commit cf96009

4 files changed

Lines changed: 35 additions & 3 deletions

File tree

devenv/Containerfile.c10s

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ RUN bcvkversion=$bcvkversion scorecardversion=$scorecardversion nushellversion=$
3939
RUN uvversion=$uvversion /run/src/install-uv.sh
4040

4141
FROM base as rust
42+
# renovate: datasource=custom.rust-nightly depName=rust-nightly versioning=rust-release-channel
43+
ARG rust_nightly=nightly-2026-03-02
4244
COPY install-rust.sh /run/src/
43-
RUN /run/src/install-rust.sh
45+
RUN rust_nightly=$rust_nightly /run/src/install-rust.sh
4446

4547
# Kani formal verification tool - requires rustup for toolchain management
4648
FROM rust as kani

devenv/Containerfile.debian

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ RUN bcvkversion=$bcvkversion scorecardversion=$scorecardversion nushellversion=$
4242
RUN uvversion=$uvversion /run/src/install-uv.sh
4343

4444
FROM base as rust
45+
# renovate: datasource=custom.rust-nightly depName=rust-nightly versioning=rust-release-channel
46+
ARG rust_nightly=nightly-2026-03-02
4547
COPY install-rust.sh /run/src/
46-
RUN /run/src/install-rust.sh
48+
RUN rust_nightly=$rust_nightly /run/src/install-rust.sh
4749

4850
# Kani formal verification tool - requires rustup for toolchain management
4951
FROM rust as kani

devenv/install-rust.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ export CARGO_HOME=/usr/local/cargo
99
# Install Rust system-wide
1010
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable --profile default
1111

12+
# Install nightly toolchain if requested (pinned date, e.g. nightly-2026-03-02)
13+
if [ -n "${rust_nightly:-}" ]; then
14+
/usr/local/cargo/bin/rustup toolchain install "${rust_nightly}" --profile minimal
15+
# Symlink the dated nightly as "nightly" so `cargo +nightly` works without
16+
# requiring write access to RUSTUP_HOME for channel updates.
17+
host=$(/usr/local/cargo/bin/rustc --print host-tuple)
18+
ln -sf "${rust_nightly}-${host}" "$RUSTUP_HOME/toolchains/nightly-${host}"
19+
fi
20+
1221
# Move binaries to /usr/local/bin (system-managed, root-owned)
1322
mv /usr/local/cargo/bin/* /usr/local/bin/
1423

renovate-shared-config.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@
1515
// referenced in Cargo.toml files. Without initializing submodules, Renovate
1616
// will fail to analyze these dependencies.
1717
"cloneSubmodules": true,
18+
// Custom datasource for tracking Rust nightly toolchain releases via the
19+
// official release manifest. This is the same data source the upcoming
20+
// native rust-version datasource (renovatebot/renovate#39529) will use;
21+
// once that merges this can be replaced with zero-config native support.
22+
"customDatasources": {
23+
"rust-nightly": {
24+
"defaultRegistryUrlTemplate": "https://static.rust-lang.org/manifests.txt",
25+
"format": "plain",
26+
"transformTemplates": [
27+
"{ \"releases\": $filter(releases, function($r) { $contains($r.version, \"channel-rust-nightly.toml\") }).$merge([{ \"version\": \"nightly-\" & $match(version, /(\\d{4}-\\d{2}-\\d{2})/).groups[0] }]) }"
28+
]
29+
}
30+
},
1831
// Custom managers for detecting dependencies in non-standard files
1932
//
2033
// - Containerfile/Dockerfile: Match "# renovate:" comments with ARG statements
@@ -24,7 +37,8 @@
2437
"customType": "regex",
2538
"managerFilePatterns": ["/(^|/)Containerfile(\\.[^/]*)?$/", "/(^|/)Dockerfile(\\.[^/]*)?$/"],
2639
"matchStrings": [
27-
"# renovate: datasource=(?<datasource>[a-z-]+) depName=(?<depName>[^\\s]+)\\s+ARG \\w+version=(?<currentValue>.+)"
40+
"# renovate: datasource=(?<datasource>[a-z.-]+) depName=(?<depName>[^\\s]+)\\s+ARG \\w+version=(?<currentValue>.+)",
41+
"# renovate: datasource=(?<datasource>[a-z.-]+) depName=(?<depName>[^\\s]+) versioning=(?<versioning>[^\\s]+)\\s+ARG \\w+=(?<currentValue>.+)"
2842
]
2943
},
3044
{
@@ -161,6 +175,11 @@
161175
"composefs-oci"
162176
],
163177
"enabled": false
178+
},
179+
// Rust nightly toolchain: use rust-release-channel versioning for nightly-YYYY-MM-DD format
180+
{
181+
"matchDatasources": ["custom.rust-nightly"],
182+
"versioning": "rust-release-channel"
164183
}
165184
]
166185
}

0 commit comments

Comments
 (0)