factor out nix code into new files via makeScope

This makes the Nix code a lot easier to reason about.
This commit is contained in:
Charles Hall 2024-04-30 16:00:19 -07:00
parent 8d8d4425f3
commit 0f8d1a5ed7
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF
5 changed files with 299 additions and 223 deletions

34
nix/shell.nix Normal file
View file

@ -0,0 +1,34 @@
# Keep sorted
{ default
, engage
, inputs
, jq
, mkShell
, system
, toolchain
}:
mkShell {
env = default.env // {
# Rust Analyzer needs to be able to find the path to default crate
# sources, and it can read this environment variable to do so. The
# `rust-src` component is required in order for this to work.
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
};
# Development tools
nativeBuildInputs = [
# Always use nightly rustfmt because most of its options are unstable
#
# This needs to come before `toolchain` in this list, otherwise
# `$PATH` will have stable rustfmt instead.
inputs.fenix.packages.${system}.latest.rustfmt
# Keep sorted
engage
jq
toolchain
]
++
default.nativeBuildInputs;
}