Skip to content

Commit

Permalink
feat(nix,rust): pin toolchain via rust-toolchain.toml (#46)
Browse files Browse the repository at this point in the history
this introduces a single source of truth for the used rust toolchain
  • Loading branch information
steveej authored Apr 24, 2024
1 parent 7b324e9 commit 16f3269
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
26 changes: 25 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 16 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,36 @@
crane.inputs.nixpkgs.follows = "nixpkgs";

flake-utils.inputs.nixpkgs.follows = "nixpkgs";

rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
};
};

outputs = {
self,
nixpkgs,
crane,
flake-utils,
rust-overlay,
}:
flake-utils.lib.eachSystem
[
flake-utils.lib.system.x86_64-linux
flake-utils.lib.system.aarch64-linux
flake-utils.lib.system.aarch64-darwin
] (system: let
pkgs = nixpkgs.legacyPackages.${system};
craneLib = crane.lib.${system};
pkgs = import nixpkgs {
inherit system;
overlays = [(import rust-overlay)];
};

customToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
craneLib = (crane.mkLib pkgs).overrideToolchain customToolchain;
in {
devShells.default = craneLib.devShell {
packages = [
Expand Down
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.74.0"

0 comments on commit 16f3269

Please sign in to comment.