36 lines
662 B
Nix
36 lines
662 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
# Rust tools for the primary user's shell environment.
|
|
let
|
|
cfg = config.modules.shell.rust;
|
|
user = config.user.name;
|
|
toolchain = pkgs.symlinkJoin {
|
|
name = "rust-toolchain";
|
|
paths = with pkgs; [
|
|
cargo
|
|
clippy
|
|
gcc
|
|
rustc
|
|
rustfmt
|
|
];
|
|
};
|
|
in
|
|
{
|
|
options.modules.shell.rust.enable = lib.mkEnableOption "Rust tools for the primary user's shell environment";
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
home-manager.users.${user} = {
|
|
home.packages = [
|
|
toolchain
|
|
pkgs.rust-analyzer
|
|
];
|
|
|
|
home.sessionVariables.RUST_TOOLCHAIN_ROOT = "${toolchain}";
|
|
};
|
|
};
|
|
}
|