Skip to content

Commit 6a522b6

Browse files
reo101nickysn
authored andcommitted
fix(nix): Provide a full Rust toolchain
- Now provides `cargo clippy` too Closes #106
1 parent 154241c commit 6a522b6

File tree

4 files changed

+59
-4
lines changed

4 files changed

+59
-4
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646
ruby-version: '3.2'
4747
- name: Setup Rust
4848
uses: dtolnay/rust-toolchain@stable
49+
with:
50+
toolchain: stable
4951
- name: Install Ruby dependencies
5052
run: bundle install
5153
- name: Setup just

flake.lock

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

flake.nix

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
{
22
description = "Development environment for codetracer-ruby-recorder";
33

4-
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
5-
inputs.pre-commit-hooks.url = "github:cachix/git-hooks.nix";
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
6+
fenix = {
7+
url = "github:nix-community/fenix";
8+
inputs.nixpkgs.follows = "nixpkgs";
9+
};
10+
pre-commit-hooks.url = "github:cachix/git-hooks.nix";
11+
};
612

713
outputs = {
814
self,
915
nixpkgs,
16+
fenix,
1017
pre-commit-hooks,
1118
}: let
1219
systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
1320
forEachSystem = nixpkgs.lib.genAttrs systems;
21+
22+
rust-toolchain-for = system: fenix.packages.${system}.fromToolchainFile {
23+
file = ./rust-toolchain.toml;
24+
sha256 = "sha256-Qxt8XAuaUR2OMdKbN4u8dBJOhSHxS+uS06Wl9+flVEk=";
25+
};
1426
in {
1527
checks = forEachSystem (system: {
1628
pre-commit-check = pre-commit-hooks.lib.${system}.run {
@@ -38,8 +50,7 @@
3850
ruby
3951

4052
# The native extension is implemented in Rust
41-
rustc
42-
cargo
53+
(rust-toolchain-for system)
4354
libiconv # Required dependency when building the rb-sys Rust crate on macOS and some Linux systems
4455

4556
# Required for bindgen (used by rb-sys crate for generating Ruby C API bindings)

rust-toolchain.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[toolchain]
2+
channel = "1.88.0"
3+
components = [ "rustc", "rust-analyzer", "rust-std", "cargo", "rustfmt", "rustc-dev", "llvm-tools" ]

0 commit comments

Comments
 (0)