grimm-nixos-laptop/common/tooling/rust.nix
2024-05-30 22:12:15 +02:00

45 lines
805 B
Nix

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