mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-26 10:06:13 +01:00
d3e46e5413
Signed-off-by: Magic_RB <magic_rb@redalder.org>
38 lines
909 B
Nix
38 lines
909 B
Nix
{ lib, pkgs, config, ... }:
|
|
with lib;
|
|
let
|
|
cfg = config.magic_rb.packageCollections.rust;
|
|
fenix = config.magic_rb.pins.fenix.packages."${pkgs.stdenv.system}";
|
|
in
|
|
{
|
|
options.magic_rb.packageCollections.rust = {
|
|
enable = mkEnableOption "Enable the Rust package collection.";
|
|
|
|
components = mkOption {
|
|
description = "Which componenets to add, such as rustc, clippy or caargo.";
|
|
type = with types; listOf str;
|
|
default = [
|
|
"cargo"
|
|
"rustc"
|
|
"rust-src"
|
|
"rust-std"
|
|
"clippy-preview"
|
|
"rustfmt-preview"
|
|
];
|
|
};
|
|
|
|
rust-analyzer = mkOption {
|
|
description = "Whether to add rust-analyzer too";
|
|
type = types.bool;
|
|
default = true;
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
home.packages = [
|
|
(fenix.latest.withComponents cfg.components)
|
|
|
|
] ++ (optional cfg.rust-analyzer fenix.rust-analyzer);
|
|
};
|
|
}
|