WIP refactor
This commit is contained in:
parent
c10446db21
commit
2087ee1015
16 changed files with 342 additions and 144 deletions
53
common/programs/rustDev.nix
Normal file
53
common/programs/rustDev.nix
Normal file
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
ccfg = import ../config.nix;
|
||||
cfg_path = [
|
||||
ccfg.custom_config_key
|
||||
"programs"
|
||||
"rustDev"
|
||||
];
|
||||
cfg = lib.attrsets.getAttrFromPath cfg_path config;
|
||||
in
|
||||
{
|
||||
options =
|
||||
{ }
|
||||
// lib.attrsets.setAttrByPath cfg_path {
|
||||
enable = lib.mkEnableOption "rust development tools";
|
||||
repl = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Enable the evcxr repl for `rust` command.";
|
||||
};
|
||||
# TODO?
|
||||
# channel = lib.mkOption {
|
||||
# type = lib.types.str;
|
||||
# default = "stable";
|
||||
# description = "The Rust release channel to use (e.g., stable, beta, nightly).";
|
||||
# };
|
||||
# version = lib.mkOption {
|
||||
# type = lib.types.str;
|
||||
# default = "latest";
|
||||
# description = "The specific version of Rust to use. Use 'latest' for the latest stable release.";
|
||||
# };
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages =
|
||||
with pkgs;
|
||||
[
|
||||
rustup
|
||||
gcc
|
||||
]
|
||||
++ (if cfg.repl then [ pkgs.evcxr ] else [ ]);
|
||||
|
||||
environment.shellAliases = lib.mkIf cfg.repl {
|
||||
rust = "evcxr";
|
||||
};
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue