2024-05-15 17:37:03 +02:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
2024-05-18 16:41:17 +02:00
|
|
|
lang_support_id = "rust";
|
|
|
|
inherit (lib)
|
|
|
|
optionals
|
|
|
|
mkIf
|
|
|
|
types
|
|
|
|
mkOption
|
|
|
|
elem
|
|
|
|
;
|
2024-05-15 17:37:03 +02:00
|
|
|
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)) {
|
2024-05-15 17:37:03 +02:00
|
|
|
environment.systemPackages =
|
|
|
|
with pkgs;
|
2024-05-18 16:41:17 +02:00
|
|
|
[
|
|
|
|
pkg-config
|
|
|
|
cargo
|
|
|
|
]
|
|
|
|
++ optionals graphical [ jetbrains.clion ];
|
2024-05-15 17:37:03 +02:00
|
|
|
|
|
|
|
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-15 17:37:03 +02:00
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2024-05-18 16:41:17 +02:00
|
|
|
|
|
|
|
options.grimmShared.tooling.supportedLangs = mkOption {
|
|
|
|
type = types.listOf (types.enum [ lang_support_id ]);
|
|
|
|
};
|
2024-05-15 17:37:03 +02:00
|
|
|
}
|