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

67 lines
1.2 KiB
Nix
Raw Normal View History

2024-05-18 16:41:17 +02:00
{
pkgs,
config,
lib,
...
}:
let
lang_support_id = "c";
inherit (config.grimmShared) enable tooling graphical;
inherit (lib)
optionals
mkIf
getExe'
types
mkOption
elem
;
in
{
config = mkIf (enable && tooling.enable && (elem lang_support_id tooling.supportedLangs)) {
environment.systemPackages =
with pkgs;
[
util-linux
linuxPackages.perf
pkg-config
glib
glibc
clang
clang-tools
2024-05-30 22:12:15 +02:00
cmake
2024-05-18 16:41:17 +02:00
]
++ optionals graphical [
libva-utils
jetbrains.clion
];
2024-05-30 22:12:15 +02:00
environment.sessionVariables.CMAKE_EXPORT_COMPILE_COMMANDS = "1";
2024-05-18 16:41:17 +02:00
grimmShared.tooling.lang_servers = [
{
lsp = {
package = pkgs.clang-tools;
};
fmt = rec {
package = pkgs.clang-tools;
command = getExe' package "clang-format";
includes = [
"*.c"
"*.h"
"*.cpp"
"*.hpp"
];
};
}
2024-05-30 22:12:15 +02:00
{
lsp = {
package = pkgs.cmake-language-server;
};
}
2024-05-18 16:41:17 +02:00
];
};
options.grimmShared.tooling.supportedLangs = mkOption {
type = types.listOf (types.enum [ lang_support_id ]);
};
}