languages/glsl: init

This commit is contained in:
poz 2025-08-27 12:12:40 +02:00
commit 4a1fc26099
No known key found for this signature in database
3 changed files with 66 additions and 0 deletions

View file

@ -394,12 +394,14 @@
[oil-git-status]: https://github.com/refractalize/oil-git-status.nvim
[neocmakelsp]: https://github.com/neocmakelsp/neocmakelsp
[arduino-language-server]: https://github.com/arduino/arduino-language-server
[glsl_analyzer]: https://github.com/nolanderc/glsl_analyzer
- Fix gitsigns null-ls issue.
- Add [everforest] theme support.
- Add [oil-git-status] support to [oil] module.
- Add CMake support with [neocmakelsp].
- Add Arduino support with [arduino-language-server].
- Add GLSL support with [glsl_analyzer].
[Haskex](https://github.com/haskex):

View file

@ -16,6 +16,7 @@ in {
./elixir.nix
./fsharp.nix
./gleam.nix
./glsl.nix
./go.nix
./hcl.nix
./helm.nix

View file

@ -0,0 +1,63 @@
{
config,
lib,
pkgs,
...
}: let
inherit (builtins) attrNames;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.nvim.types) mkGrammarOption;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) enum listOf;
inherit (lib.meta) getExe;
inherit (lib.nvim.attrsets) mapListToAttrs;
cfg = config.vim.languages.glsl;
defaultServers = ["glsl_analyzer"];
servers = {
glsl_analyzer = {
enable = true;
cmd = [(getExe pkgs.glsl_analyzer)];
filetypes = ["glsl" "vert" "tesc" "tese" "frag" "geom" "comp"];
root_markers = [".git"];
};
};
in {
options.vim.languages.glsl = {
enable = mkEnableOption "GLSL language support";
treesitter = {
enable = mkEnableOption "GLSL treesitter" // {default = config.vim.languages.enableTreesitter;};
package = mkGrammarOption pkgs "glsl";
};
lsp = {
enable = mkEnableOption "GLSL LSP support" // {default = config.vim.lsp.enable;};
servers = mkOption {
type = listOf (enum (attrNames servers));
default = defaultServers;
description = "GLSL LSP server to use";
};
};
};
config = mkIf cfg.enable (mkMerge [
(mkIf cfg.treesitter.enable {
vim.treesitter = {
enable = true;
grammars = [cfg.treesitter.package];
};
})
(mkIf cfg.lsp.enable {
vim.lsp.servers =
mapListToAttrs (n: {
name = n;
value = servers.${n};
})
cfg.lsp.servers;
})
]);
}