Files
dev/configs/nixos/modules/shell/rust.nix

37 lines
709 B
Nix

{
config,
lib,
pkgs,
...
}:
# Rust tools for the primary user's shell environment.
let
cfg = config.modules.shell.rust; # NOLINT(let_order)
toolchain = pkgs.symlinkJoin {
name = "rust-toolchain";
paths = with pkgs; [
cargo
clippy
gcc
rustc
rustfmt
];
};
user = config.user.name;
in
{
options.modules.shell.rust.enable =
lib.mkEnableOption "Rust tools for the primary user's shell environment";
config = lib.mkIf cfg.enable {
registry.env-var.${config.networking.hostName}.RUST_TOOLCHAIN_ROOT = "${toolchain}";
home-manager.users.${user} = {
home.packages = [
toolchain
pkgs.rust-analyzer
];
};
};
}