{ 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 { registry.env-var.${config.networking.hostName}.RUST_TOOLCHAIN_ROOT = "${toolchain}"; home-manager.users.${user} = { home.packages = [ toolchain pkgs.rust-analyzer ]; }; }; }