From fa0664aa1f58ff0b47c707d75d0da8c64ef8c85f Mon Sep 17 00:00:00 2001 From: James Kay Date: Thu, 16 Nov 2023 16:47:29 +0000 Subject: [PATCH] Add a Nix devShell for the linting toolchain --- flake.lock | 30 +++++++++++++++--------------- flake.nix | 18 ++++++++++-------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/flake.lock b/flake.lock index f419aaf0e9c9..bbf8113879d8 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1696343447, - "narHash": "sha256-B2xAZKLkkeRFG5XcHHSXXcP7To9Xzr59KXeZiRf4vdQ=", + "lastModified": 1698882062, + "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "c9afaba3dfa4085dbd2ccb38dfade5141e33d9d4", + "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", "type": "github" }, "original": { @@ -38,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1697723726, - "narHash": "sha256-SaTWPkI8a5xSHX/rrKzUe+/uVNy6zCGMXgoeMb7T9rg=", + "lastModified": 1699781429, + "narHash": "sha256-UYefjidASiLORAjIvVsUHG6WBtRhM67kTjEY4XfZOFs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "7c9cc5a6e5d38010801741ac830a3f8fd667a7a0", + "rev": "e44462d6021bfe23dfb24b775cc7c390844f773d", "type": "github" }, "original": { @@ -55,11 +55,11 @@ "nixpkgs-lib": { "locked": { "dir": "lib", - "lastModified": 1696019113, - "narHash": "sha256-X3+DKYWJm93DRSdC5M6K5hLqzSya9BjibtBsuARoPco=", + "lastModified": 1698611440, + "narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f5892ddac112a1e9b3612c39af1b72987ee5783a", + "rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735", "type": "github" }, "original": { @@ -117,11 +117,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1697940838, - "narHash": "sha256-eyk92QqAoRNC0V99KOcKcBZjLPixxNBS0PRc4KlSQVs=", + "lastModified": 1700100993, + "narHash": "sha256-Zc//DbR3eMGajG09iQUMTO/Tc/fdUYmTAzXYdxx5MKw=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "a3e829c06eadf848f13d109c7648570ce37ebccd", + "rev": "b7a041430733fccaa1ffc3724bb9454289d0f701", "type": "github" }, "original": { @@ -165,11 +165,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1697388351, - "narHash": "sha256-63N2eBpKaziIy4R44vjpUu8Nz5fCJY7okKrkixvDQmY=", + "lastModified": 1699786194, + "narHash": "sha256-3h3EH1FXQkIeAuzaWB+nK0XK54uSD46pp+dMD3gAcB4=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "aae39f64f5ecbe89792d05eacea5cb241891292a", + "rev": "e82f32aa7f06bbbd56d7b12186d555223dc399d1", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 7ffc8094d8e7..2c3487e99a73 100644 --- a/flake.nix +++ b/flake.nix @@ -26,12 +26,10 @@ pkg-config nodejs ]; - rustToolchain = (pkgs.rust-bin.fromRustupToolchainFile - ./rust-toolchain.toml); - rustPlatform = pkgs.makeRustPlatform { - rustc = rustToolchain; - cargo = rustToolchain; - }; + rustBuildToolchain = (pkgs.rust-bin.fromRustupToolchainFile + ./toolchains/build/rust-toolchain.toml); + rustLintToolchain = (pkgs.rust-bin.fromRustupToolchainFile + ./toolchains/lint/rust-toolchain.toml); in { _module.args.pkgs = import inputs.nixpkgs { inherit system; @@ -45,17 +43,21 @@ ]; shellHook = '' # For rust-analyzer 'hover' tooltips to work. - export RUST_SRC_PATH=${rustToolchain.availableComponents.rust-src} + export RUST_SRC_PATH=${rustBuildToolchain.availableComponents.rust-src} export LIBCLANG_PATH=${pkgs.libclang.lib}/lib export PATH=$PWD/target/release:~/.cargo/bin:$PATH ''; buildInputs = nonRustDeps; nativeBuildInputs = with pkgs; [ - rustToolchain + rustBuildToolchain rust-analyzer ]; }; + devShells.lint = pkgs.mkShell { + nativeBuildInputs = [ rustLintToolchain ]; + }; + # Add your auto-formatters here. # cf. https://numtide.github.io/treefmt/ treefmt.config = {