Skip to content

Commit

Permalink
Add a Nix devShell for the linting toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
Twey committed Nov 20, 2023
1 parent 711e623 commit 11d3b4a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
30 changes: 15 additions & 15 deletions flake.lock

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

18 changes: 10 additions & 8 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 = {
Expand Down

0 comments on commit 11d3b4a

Please sign in to comment.