build(Cargo.toml): set minimum supported Rust version

Sets the MSRV for the crate. The `rust-toolchain.toml` file is dropped since
this is too retrictive when choosing choosing a toolchain for developing the
crate – uses exact semantics.

It is necessary to change the `flake.nix` to read this version from the
`Cargo.toml` so that it can select the rust toolchain to use via `rust-overlay`.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
Co-authored-by: Fintan Halpenny <fintan.halpenny@gmail.com>
This commit is contained in:
Lars Wirzenius
2025-05-15 14:40:10 +02:00
committed by Fintan Halpenny
co-authored by Fintan Halpenny
parent 1238715ff4
commit b41229ca07
4 changed files with 17 additions and 14 deletions
+3
View File
@@ -5,6 +5,9 @@ license = "MIT OR Apache-2.0"
version = "0.1.0" version = "0.1.0"
authors = ["Fintan Halpenny <fintan.halpenny@gmail.com>"] authors = ["Fintan Halpenny <fintan.halpenny@gmail.com>"]
edition = "2021" edition = "2021"
# N.B. always use the full semver so that rust-overlay in `flake.nix` can select
# the correct version
rust-version = "1.82.0"
[dependencies] [dependencies]
indexmap = { version = "2.7.1", features = ["serde"] } indexmap = { version = "2.7.1", features = ["serde"] }
Generated
+9 -9
View File
@@ -2,11 +2,11 @@
"nodes": { "nodes": {
"crane": { "crane": {
"locked": { "locked": {
"lastModified": 1742394900, "lastModified": 1747260204,
"narHash": "sha256-vVOAp9ahvnU+fQoKd4SEXB2JG2wbENkpqcwlkIXgUC0=", "narHash": "sha256-KUb6MFWc2DYeTCmcEkrBrrqhxAgO6NHZh5qQKwsjG6I=",
"owner": "ipetkov", "owner": "ipetkov",
"repo": "crane", "repo": "crane",
"rev": "70947c1908108c0c551ddfd73d4f750ff2ea67cd", "rev": "7f85510df37247c86a0c44032f49aa18292ee11f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -35,11 +35,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1742998488, "lastModified": 1747308931,
"narHash": "sha256-r7dqSLNkzg1rOPsq4Tuc6p+UtAGqNRMma4riupsuZv4=", "narHash": "sha256-aFP8PqwBbokBQ6IKpD71RbhSWV4qjyg6M0y62rodRts=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "8e0b1e9c8c4dfaef0ff85e09c91294ba4afa4168", "rev": "ed8ec80540abb9a7e69da65916cf3d0b26174555",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -64,11 +64,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1742956365, "lastModified": 1747190175,
"narHash": "sha256-Slrqmt6kJ/M7Z/ce4ebQWsz2aeEodrX56CsupOEPoz0=", "narHash": "sha256-s33mQ2s5L/2nyllhRTywgECNZyCqyF4MJeM3vG/GaRo=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "a0e3395c63cdbc9c1ec17915f8328c077c79c4a1", "rev": "58160be7abad81f6f8cb53120d5b88c16e01c06d",
"type": "github" "type": "github"
}, },
"original": { "original": {
+5 -1
View File
@@ -29,7 +29,10 @@
overlays = [(import rust-overlay)]; overlays = [(import rust-overlay)];
}; };
rustToolChain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; # Get the `rust-version` from the Cargo manifest
manifest = builtins.fromTOML (builtins.readFile ./Cargo.toml);
rust-version = manifest.package.rust-version;
rustToolChain = pkgs.rust-bin.stable.${rust-version}.default;
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolChain; craneLib = (crane.mkLib pkgs).overrideToolchain rustToolChain;
src = lib.cleanSourceWith { src = lib.cleanSourceWith {
@@ -99,6 +102,7 @@
# Extra inputs can be added here; cargo and rustc are provided by default # Extra inputs can be added here; cargo and rustc are provided by default
# from the toolchain that was specified earlier. # from the toolchain that was specified earlier.
packages = with pkgs; [ packages = with pkgs; [
cargo-nextest
cargo-watch cargo-watch
ripgrep ripgrep
rust-analyzer rust-analyzer
-4
View File
@@ -1,4 +0,0 @@
[toolchain]
channel = "1.84"
profile = "default"
components = [ "rust-src" ]