grimm-nixos-laptop/common/tooling/rust.nix

45 lines
805 B
Nix
Raw Normal View History

{
pkgs,
lib,
config,
...
}:
let
2024-05-18 16:41:17 +02:00
lang_support_id = "rust";
inherit (lib)
optionals
mkIf
types
mkOption
elem
;
inherit (config.grimmShared) enable tooling graphical;
in
{
2024-05-18 16:41:17 +02:00
config = mkIf (enable && tooling.enable && (elem lang_support_id tooling.supportedLangs)) {
environment.systemPackages =
with pkgs;
2024-05-18 16:41:17 +02:00
[
pkg-config
cargo
]
++ optionals graphical [ jetbrains.clion ];
grimmShared.tooling.lang_servers = [
{
2024-05-15 23:24:35 +02:00
lsp = {
package = pkgs.rust-analyzer;
};
fmt = {
package = pkgs.rustfmt;
includes = [ "*.rs" ];
};
}
];
};
2024-05-18 16:41:17 +02:00
options.grimmShared.tooling.supportedLangs = mkOption {
type = types.listOf (types.enum [ lang_support_id ]);
};
}