2021-04-11 00:25:36 +02:00
|
|
|
{ lib, pkgs, config, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.magic_rb.packageCollections.rust;
|
|
|
|
fenix = config.magic_rb.pins.fenix.packages."${pkgs.stdenv.system}";
|
|
|
|
in
|
2021-01-25 20:40:55 +01:00
|
|
|
{
|
2021-04-11 00:25:36 +02:00
|
|
|
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"
|
|
|
|
];
|
2021-01-25 20:40:55 +01:00
|
|
|
};
|
2021-04-11 00:25:36 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
};
|
2021-01-25 20:40:55 +01:00
|
|
|
}
|