add rust-dev

This commit is contained in:
RingOfStorms (Joshua Bell) 2025-02-04 15:55:40 -06:00
parent 4cbf460fda
commit 4ed398b5e5
2 changed files with 51 additions and 1 deletions

View file

@ -0,0 +1,50 @@
{
config,
lib,
pkgs,
...
}:
with lib;
let
rustChannel = config.programs.rust.channel;
rustVersion = config.programs.rust.version;
in
{
options.components.rust = {
enable = mkOption {
type = types.bool;
default = true;
description = "Enable Rust programming language support.";
};
repl = mkOption {
type = types.bool;
default = true;
description = "Enable the evcxr repl for `rust` command.";
};
channel = mkOption {
type = types.str;
default = "stable";
description = "The Rust release channel to use (e.g., stable, beta, nightly).";
};
version = mkOption {
type = types.str;
default = "latest";
description = "The specific version of Rust to use. Use 'latest' for the latest stable release.";
};
};
config = mkIf config.components.rust.enable {
environment.systemPackages = [
pkgs.rustup
] ++ (if config.components.rust.repl then [ pkgs.evcxr ] else [ ]);
environment.shellAliases = mkIf config.components.rust.repl {
rust = "evcxr";
};
};
}