From b137c7b5ea551aec2a186fea51a0959461c032d9 Mon Sep 17 00:00:00 2001 From: Ogulcan Celik Date: Thu, 9 Jul 2026 22:43:25 +0300 Subject: [PATCH] ci: pin rust toolchain to 1.96.1 --- .github/workflows/build-artifacts-manual.yml | 10 +++-- .github/workflows/ci.yml | 12 ++++- .github/workflows/preview.yml | 9 +++- .github/workflows/release.yml | 4 +- flake.lock | 23 +++++++++- flake.nix | 47 +++++++++++++++----- rust-toolchain.toml | 3 ++ 7 files changed, 89 insertions(+), 19 deletions(-) create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/build-artifacts-manual.yml b/.github/workflows/build-artifacts-manual.yml index 320526ef..3896138c 100644 --- a/.github/workflows/build-artifacts-manual.yml +++ b/.github/workflows/build-artifacts-manual.yml @@ -38,6 +38,7 @@ permissions: env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + RUST_TOOLCHAIN_VERSION: 1.96.1 jobs: build-linux: @@ -63,8 +64,9 @@ jobs: persist-credentials: false - name: Install Rust - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # v1 with: + toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} targets: ${{ matrix.target }} - name: Install Zig @@ -146,8 +148,9 @@ jobs: persist-credentials: false - name: Install Rust - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # v1 with: + toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} targets: ${{ matrix.target }} - name: Install Zig @@ -198,8 +201,9 @@ jobs: persist-credentials: false - name: Install Rust - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # v1 with: + toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} targets: x86_64-pc-windows-msvc - name: Install Zig diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a3f723b..ca1ebce8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,9 @@ on: permissions: contents: read +env: + RUST_TOOLCHAIN_VERSION: 1.96.1 + concurrency: group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true @@ -59,12 +62,17 @@ jobs: - name: Install Rust if: matrix.kind == 'unix' - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # v1 + with: + toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} + components: rustfmt,clippy - name: Install Rust if: matrix.kind == 'windows' - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # v1 with: + toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} + components: rustfmt,clippy targets: x86_64-pc-windows-msvc - name: Install Rust tools diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 1adfcc98..fabb2edc 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -13,6 +13,7 @@ permissions: env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + RUST_TOOLCHAIN_VERSION: 1.96.1 concurrency: group: preview-publish @@ -82,7 +83,10 @@ jobs: - name: Install Rust if: steps.plan.outputs.should_publish == 'true' - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # v1 + with: + toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} + components: rustfmt,clippy - name: Install Rust tools if: steps.plan.outputs.should_publish == 'true' @@ -150,8 +154,9 @@ jobs: persist-credentials: false - name: Install Rust - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # v1 with: + toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} targets: ${{ matrix.target }} - name: Install Zig diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4d1e256d..2d07a8f8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,6 +10,7 @@ permissions: env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true + RUST_TOOLCHAIN_VERSION: 1.96.1 jobs: flake-check: @@ -81,8 +82,9 @@ jobs: fi - name: Install Rust - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # v1 with: + toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} targets: ${{ matrix.target }} - name: Install Zig diff --git a/flake.lock b/flake.lock index 421a64fc..55be748e 100644 --- a/flake.lock +++ b/flake.lock @@ -18,7 +18,28 @@ }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1783577481, + "narHash": "sha256-EWMxOWrJ031f8f/lrcEmhTRs4npw1/5N3Hcjin846c8=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "4cdea398dc491b082dccdce0fad1ed0b75fa3394", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 3a91a3ca..4d49de7d 100644 --- a/flake.nix +++ b/flake.nix @@ -3,10 +3,18 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = - { self, nixpkgs }: + { + self, + nixpkgs, + rust-overlay, + }: let lib = nixpkgs.lib; systems = [ @@ -16,14 +24,31 @@ "aarch64-darwin" ]; forAllSystems = lib.genAttrs systems; - pkgsFor = system: import nixpkgs { inherit system; }; + pkgsFor = + system: + import nixpkgs { + inherit system; + overlays = [ rust-overlay.overlays.default ]; + }; + rustToolchainFor = pkgs: pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + rustPlatformFor = + pkgs: + let + rustToolchain = rustToolchainFor pkgs; + in + pkgs.makeRustPlatform { + cargo = rustToolchain; + rustc = rustToolchain; + }; in { packages = forAllSystems ( system: let pkgs = pkgsFor system; - herdr = pkgs.callPackage ./nix/package.nix { }; + herdr = pkgs.callPackage ./nix/package.nix { + rustPlatform = rustPlatformFor pkgs; + }; in { inherit herdr; @@ -48,20 +73,18 @@ system: let pkgs = pkgsFor system; + rustToolchain = rustToolchainFor pkgs; in { default = pkgs.mkShell { name = "herdr-dev"; packages = with pkgs; [ - cargo cargo-nextest - clippy cmake just ninja pkg-config - rustc - rustfmt + rustToolchain zig_0_15 ]; @@ -75,8 +98,12 @@ formatter = forAllSystems (system: (pkgsFor system).nixfmt); - overlays.default = final: _prev: { - herdr = final.callPackage ./nix/package.nix { }; - }; + overlays.default = lib.composeExtensions rust-overlay.overlays.default ( + final: _prev: { + herdr = final.callPackage ./nix/package.nix { + rustPlatform = rustPlatformFor final; + }; + } + ); }; } diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 00000000..94038228 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.96.1" +components = ["clippy", "rustfmt"]