23 lines
470 B
Nix
23 lines
470 B
Nix
{ pkgs, ... }:
|
|
pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
cargo
|
|
rustc
|
|
rustfmt
|
|
clippy
|
|
cargo-udeps
|
|
cargo-outdated
|
|
];
|
|
|
|
shellHook = ''
|
|
if git rev-parse --is-inside-work-tree &> /dev/null; then
|
|
TOP="$(git rev-parse --show-toplevel)"
|
|
if ! grep -q "^\.cargo$" "$TOP/.gitignore" "$TOP/.git/info/exclude"; then echo ".cargo" >> "$TOP/.git/info/exclude"; fi
|
|
else
|
|
TOP="$(pwd)"
|
|
fi
|
|
|
|
export CARGO_HOME="$TOP/.cargo"
|
|
'';
|
|
}
|