mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +00:00
modules/languages: finish making lib calls explicit
This commit is contained in:
parent
f2c90a861d
commit
dfc7c6737f
16 changed files with 301 additions and 217 deletions
|
@ -5,7 +5,12 @@
|
|||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) mkEnableOption mkOption mkIf mkMerge isList types nvim;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
|
||||
cfg = config.vim.languages.css;
|
||||
|
||||
|
@ -25,7 +30,7 @@
|
|||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/vscode-css-language-server", "--stdio"}''
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +44,7 @@ in {
|
|||
treesitter = {
|
||||
enable = mkEnableOption "CSS treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
|
||||
package = nvim.types.mkGrammarOption pkgs "css";
|
||||
package = mkGrammarOption pkgs "css";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
|
@ -47,14 +52,14 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "CSS LSP server to use";
|
||||
type = with types; enum (attrNames servers);
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "CSS LSP server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]'';
|
||||
type = with types; either package (listOf str);
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim getExe mkEnableOption mkOption types mkMerge mkIf;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) bool enum either listOf package str;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
|
||||
cfg = config.vim.languages.go;
|
||||
|
||||
|
@ -19,13 +25,14 @@
|
|||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/gopls", "serve"}''
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
defaultDebugger = "delve";
|
||||
debuggers = {
|
||||
delve = {
|
||||
|
@ -73,7 +80,7 @@ in {
|
|||
treesitter = {
|
||||
enable = mkEnableOption "Go treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
|
||||
package = nvim.types.mkGrammarOption pkgs "go";
|
||||
package = mkGrammarOption pkgs "go";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
|
@ -81,14 +88,14 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "Go LSP server to use";
|
||||
type = with types; enum (attrNames servers);
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Go LSP server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]'';
|
||||
type = with types; either package (listOf str);
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
|
@ -96,17 +103,17 @@ in {
|
|||
dap = {
|
||||
enable = mkOption {
|
||||
description = "Enable Go Debug Adapter";
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = config.vim.languages.enableDAP;
|
||||
};
|
||||
debugger = mkOption {
|
||||
description = "Go debugger to use";
|
||||
type = with types; enum (attrNames debuggers);
|
||||
type = enum (attrNames debuggers);
|
||||
default = defaultDebugger;
|
||||
};
|
||||
package = mkOption {
|
||||
description = "Go debugger package.";
|
||||
type = types.package;
|
||||
type = package;
|
||||
default = debuggers.${cfg.dap.debugger}.package;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,27 +1,26 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkEnableOption mkOption types nvim mkIf mkMerge optional;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) bool;
|
||||
inherit (lib.lists) optional;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.languages.html;
|
||||
in {
|
||||
options.vim.languages.html = {
|
||||
enable = mkEnableOption "HTML language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkOption {
|
||||
description = "Enable HTML treesitter";
|
||||
type = types.bool;
|
||||
default = config.vim.languages.enableTreesitter;
|
||||
};
|
||||
package = nvim.types.mkGrammarOption pkgs "html";
|
||||
|
||||
enable = mkEnableOption "HTML treesitter support" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "html";
|
||||
autotagHtml = mkOption {
|
||||
description = "Enable autoclose/autorename of html tags (nvim-ts-autotag)";
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = true;
|
||||
};
|
||||
};
|
||||
|
@ -29,14 +28,18 @@ in {
|
|||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
vim = {
|
||||
startPlugins = optional cfg.treesitter.autotagHtml "nvim-ts-autotag";
|
||||
|
||||
vim.startPlugins = optional cfg.treesitter.autotagHtml "nvim-ts-autotag";
|
||||
treesitter = {
|
||||
enable = true;
|
||||
grammars = [cfg.treesitter.package];
|
||||
};
|
||||
|
||||
vim.luaConfigRC.html-autotag = mkIf cfg.treesitter.autotagHtml (nvim.dag.entryAnywhere ''
|
||||
luaConfigRC.html-autotag = mkIf cfg.treesitter.autotagHtml (entryAnywhere ''
|
||||
require('nvim-ts-autotag').setup()
|
||||
'');
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge getExe;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) either listOf package str;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
|
||||
cfg = config.vim.languages.java;
|
||||
in {
|
||||
|
@ -13,16 +19,15 @@ in {
|
|||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Java treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = nvim.types.mkGrammarOption pkgs "java";
|
||||
package = mkGrammarOption pkgs "java";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Java LSP support (java-language-server)" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
package = mkOption {
|
||||
description = "java language server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||
type = with types; either package (listOf str);
|
||||
type = either package (listOf str);
|
||||
default = pkgs.jdt-language-server;
|
||||
};
|
||||
};
|
||||
|
@ -37,7 +42,7 @@ in {
|
|||
on_attach = default_on_attach,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${getExe cfg.lsp.package}", "-data", vim.fn.stdpath("cache").."/jdtls/workspace"}''
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge optionalString getExe;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.types) either listOf package str;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.dag) entryBefore;
|
||||
|
||||
cfg = config.vim.languages.lua;
|
||||
in {
|
||||
|
@ -12,14 +20,15 @@ in {
|
|||
enable = mkEnableOption "Lua language support";
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Lua Treesitter support" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = nvim.types.mkGrammarOption pkgs "lua";
|
||||
package = mkGrammarOption pkgs "lua";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Lua LSP support via LuaLS" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
package = mkOption {
|
||||
description = "LuaLS package, or the command to run as a list of strings";
|
||||
type = with types; either package (listOf str);
|
||||
type = either package (listOf str);
|
||||
default = pkgs.lua-language-server;
|
||||
};
|
||||
|
||||
|
@ -43,7 +52,7 @@ in {
|
|||
${optionalString cfg.lsp.neodev.enable "before_init = require('neodev.lsp').before_init;"}
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${getExe cfg.lsp.package}"}''
|
||||
};
|
||||
}
|
||||
|
@ -52,7 +61,7 @@ in {
|
|||
|
||||
(mkIf cfg.lsp.neodev.enable {
|
||||
vim.startPlugins = ["neodev-nvim"];
|
||||
vim.luaConfigRC.neodev = nvim.dag.entryBefore ["lua-lsp"] ''
|
||||
vim.luaConfigRC.neodev = entryBefore ["lua-lsp"] ''
|
||||
require("neodev").setup({})
|
||||
'';
|
||||
})
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
|
||||
cfg = config.vim.languages.nim;
|
||||
|
||||
defaultServer = "nimlsp";
|
||||
|
@ -18,7 +24,7 @@
|
|||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''
|
||||
{"${cfg.lsp.package}/bin/nimlsp"}
|
||||
''
|
||||
|
@ -47,41 +53,37 @@ in {
|
|||
enable = mkEnableOption "Nim language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkOption {
|
||||
description = "Enable Nim treesitter";
|
||||
type = types.bool;
|
||||
default = config.vim.languages.enableTreesitter;
|
||||
};
|
||||
package = nvim.types.mkGrammarOption pkgs "nim";
|
||||
enable = mkEnableOption "Nim treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "nim";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Nim LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Nim LSP server to use";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Nim LSP server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.nimlsp]'';
|
||||
type = with types; either package (listOf str);
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
|
||||
format = {
|
||||
enable = mkEnableOption "Nim formatting" // {default = config.vim.languages.enableFormat;};
|
||||
|
||||
type = mkOption {
|
||||
description = "Nim formatter to use";
|
||||
type = with types; enum (attrNames formats);
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Nim formatter package";
|
||||
type = types.package;
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge optionalString;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.languages.nix;
|
||||
|
||||
|
@ -82,6 +88,7 @@
|
|||
)
|
||||
'';
|
||||
};
|
||||
|
||||
nixpkgs-fmt = {
|
||||
package = pkgs.nixpkgs-fmt;
|
||||
# Never need to use null-ls for nixpkgs-fmt
|
||||
|
@ -101,6 +108,7 @@
|
|||
)
|
||||
'';
|
||||
};
|
||||
|
||||
deadnix = {
|
||||
package = pkgs.deadnix;
|
||||
nullConfig = pkg: ''
|
||||
|
@ -118,26 +126,22 @@ in {
|
|||
enable = mkEnableOption "Nix language support";
|
||||
|
||||
treesitter = {
|
||||
enable = mkOption {
|
||||
description = "Enable Nix treesitter";
|
||||
type = types.bool;
|
||||
default = config.vim.languages.enableTreesitter;
|
||||
};
|
||||
package = nvim.types.mkGrammarOption pkgs "nix";
|
||||
enable = mkEnableOption "Nix treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkGrammarOption pkgs "nix";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Nix LSP support" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
server = mkOption {
|
||||
description = "Nix LSP server to use";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Nix LSP server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||
type = with types; either package (listOf str);
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
|
@ -147,22 +151,19 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "Nix formatter to use";
|
||||
type = with types; enum (attrNames formats);
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
package = mkOption {
|
||||
description = "Nix formatter package";
|
||||
type = types.package;
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
|
||||
extraDiagnostics = {
|
||||
enable = mkOption {
|
||||
description = "Enable extra Nix diagnostics";
|
||||
type = types.bool;
|
||||
default = config.vim.languages.enableExtraDiagnostics;
|
||||
};
|
||||
enable = mkEnableOption "extra Nix diagnostics" // {default = config.vim.languages.enableExtraDiagnostics;};
|
||||
|
||||
types = lib.nvim.types.diagnostics {
|
||||
langDesc = "Nix";
|
||||
inherit diagnostics;
|
||||
|
@ -173,7 +174,7 @@ in {
|
|||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
{
|
||||
vim.configRC.nix = nvim.dag.entryAnywhere ''
|
||||
vim.configRC.nix = entryAnywhere ''
|
||||
autocmd filetype nix setlocal tabstop=2 shiftwidth=2 softtabstop=2
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge getExe;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
|
||||
cfg = config.vim.languages.php;
|
||||
|
||||
|
@ -19,7 +25,7 @@
|
|||
on_attach = default_on_attach,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''
|
||||
{
|
||||
"${getExe cfg.lsp.package}",
|
||||
|
@ -39,7 +45,7 @@
|
|||
on_attach = default_on_attach,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''
|
||||
{
|
||||
"${getExe cfg.lsp.package}",
|
||||
|
@ -65,7 +71,7 @@ in {
|
|||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "PHP treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = nvim.types.mkGrammarOption pkgs "php";
|
||||
package = mkGrammarOption pkgs "php";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
|
@ -73,14 +79,14 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "PHP LSP server to use";
|
||||
type = with types; enum (attrNames servers);
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "PHP LSP server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]'';
|
||||
type = with types; either package (listOf str);
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge getExe literalExpression;
|
||||
inherit (lib.options) mkEnableOption mkOption literalExpression;
|
||||
inherit (lib.meta) getExe;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str bool;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
|
||||
cfg = config.vim.languages.python;
|
||||
|
||||
|
@ -19,7 +24,7 @@
|
|||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/pyright-langserver", "--stdio"}''
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +45,7 @@
|
|||
)
|
||||
'';
|
||||
};
|
||||
|
||||
isort = {
|
||||
package = pkgs.isort;
|
||||
nullConfig = ''
|
||||
|
@ -51,6 +57,7 @@
|
|||
)
|
||||
'';
|
||||
};
|
||||
|
||||
black-and-isort = {
|
||||
package = pkgs.writeShellApplication {
|
||||
name = "black";
|
||||
|
@ -140,7 +147,7 @@ in {
|
|||
enable = mkEnableOption "Python treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = mkOption {
|
||||
description = "Python treesitter grammar to use";
|
||||
type = types.package;
|
||||
type = package;
|
||||
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.python;
|
||||
};
|
||||
};
|
||||
|
@ -150,14 +157,14 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "Python LSP server to use";
|
||||
type = with types; enum (attrNames servers);
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "python LSP server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||
type = with types; either package (listOf str);
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
|
@ -167,13 +174,13 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "Python formatter to use";
|
||||
type = with types; enum (attrNames formats);
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Python formatter package";
|
||||
type = types.package;
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
|
@ -182,25 +189,28 @@ in {
|
|||
dap = {
|
||||
enable = mkOption {
|
||||
description = "Enable Python Debug Adapter";
|
||||
type = types.bool;
|
||||
type = bool;
|
||||
default = config.vim.languages.enableDAP;
|
||||
};
|
||||
|
||||
debugger = mkOption {
|
||||
description = "Python debugger to use";
|
||||
type = with types; enum (attrNames debuggers);
|
||||
type = enum (attrNames debuggers);
|
||||
default = defaultDebugger;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = package;
|
||||
default = debuggers.${cfg.dap.debugger}.package;
|
||||
example = literalExpression "with pkgs; python39.withPackages (ps: with ps; [debugpy])";
|
||||
description = ''
|
||||
Python debugger package.
|
||||
This is a python package with debugpy installed, see https://nixos.wiki/wiki/Python#Install_Python_Packages.
|
||||
'';
|
||||
example = literalExpression "with pkgs; python39.withPackages (ps: with ps; [debugpy])";
|
||||
type = types.package;
|
||||
default = debuggers.${cfg.dap.debugger}.package;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
|
@ -27,7 +27,6 @@ in {
|
|||
|
||||
lsp = {
|
||||
enable = mkEnableOption "Rust LSP support (rust-analyzer with extra tools)" // {default = config.vim.languages.enableLSP;};
|
||||
|
||||
package = mkOption {
|
||||
description = "rust-analyzer package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||
|
@ -48,6 +47,7 @@ in {
|
|||
type = types.bool;
|
||||
default = config.vim.languages.enableDAP;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "lldb pacakge";
|
||||
type = types.package;
|
||||
|
@ -58,12 +58,11 @@ in {
|
|||
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
(mkIf cfg.crates.enable {
|
||||
vim.lsp.null-ls.enable = mkIf cfg.crates.codeActions true;
|
||||
|
||||
vim.startPlugins = ["crates-nvim"];
|
||||
|
||||
vim.autocomplete.sources = {"crates" = "[Crates]";};
|
||||
vim.luaConfigRC.rust-crates = nvim.dag.entryAnywhere ''
|
||||
vim = {
|
||||
startPlugins = ["crates-nvim"];
|
||||
lsp.null-ls.enable = mkIf cfg.crates.codeActions true;
|
||||
autocomplete.sources = {"crates" = "[Crates]";};
|
||||
luaConfigRC.rust-crates = nvim.dag.entryAnywhere ''
|
||||
require('crates').setup {
|
||||
null_ls = {
|
||||
enabled = ${boolToString cfg.crates.codeActions},
|
||||
|
@ -71,16 +70,21 @@ in {
|
|||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.treesitter.enable {
|
||||
vim.treesitter.enable = true;
|
||||
vim.treesitter.grammars = [cfg.treesitter.package];
|
||||
})
|
||||
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
||||
vim.startPlugins = ["rust-tools"] ++ optionals cfg.dap.enable [cfg.dap.package];
|
||||
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.rust-lsp = ''
|
||||
(mkIf (cfg.lsp.enable || cfg.dap.enable) {
|
||||
vim = {
|
||||
startPlugins = ["rust-tools"] ++ optionals cfg.dap.enable [cfg.dap.package];
|
||||
|
||||
lsp.lspconfig = {
|
||||
enable = true;
|
||||
sources.rust-lsp = ''
|
||||
local rt = require('rust-tools')
|
||||
rust_on_attach = function(client, bufnr)
|
||||
default_on_attach(client, bufnr)
|
||||
|
@ -141,6 +145,8 @@ in {
|
|||
}
|
||||
rt.setup(rustopts)
|
||||
'';
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
|
||||
cfg = config.vim.languages.sql;
|
||||
sqlfluffDefault = pkgs.sqlfluff;
|
||||
|
@ -23,7 +27,7 @@
|
|||
end,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{ "${cfg.lsp.package}/bin/sqls", "-config", string.format("%s/config.yml", vim.fn.getcwd()) }''
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +72,7 @@ in {
|
|||
|
||||
dialect = mkOption {
|
||||
description = "SQL dialect for sqlfluff (if used)";
|
||||
type = types.str;
|
||||
type = str;
|
||||
default = "ansi";
|
||||
};
|
||||
|
||||
|
@ -77,7 +81,7 @@ in {
|
|||
|
||||
package = mkOption {
|
||||
description = "SQL treesitter grammar to use";
|
||||
type = types.package;
|
||||
type = package;
|
||||
default = pkgs.vimPlugins.nvim-treesitter.builtGrammars.sql;
|
||||
};
|
||||
};
|
||||
|
@ -87,14 +91,14 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "SQL LSP server to use";
|
||||
type = with types; enum (attrNames servers);
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "SQL LSP server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||
type = with types; either package (listOf str);
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
|
@ -104,13 +108,13 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "SQL formatter to use";
|
||||
type = with types; enum (attrNames formats);
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "SQL formatter package";
|
||||
type = types.package;
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
|
@ -133,10 +137,14 @@ in {
|
|||
})
|
||||
|
||||
(mkIf cfg.lsp.enable {
|
||||
vim.startPlugins = ["sqls-nvim"];
|
||||
vim = {
|
||||
startPlugins = ["sqls-nvim"];
|
||||
|
||||
vim.lsp.lspconfig.enable = true;
|
||||
vim.lsp.lspconfig.sources.sql-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
lsp.lspconfig = {
|
||||
enable = true;
|
||||
sources.sql-lsp = servers.${cfg.lsp.server}.lspConfig;
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
(mkIf cfg.format.enable {
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.svelte;
|
||||
|
||||
|
@ -19,7 +24,7 @@
|
|||
on_attach = attach_keymaps,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/svelteserver", "--stdio"}''
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +70,7 @@ in {
|
|||
treesitter = {
|
||||
enable = mkEnableOption "Svelte treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
|
||||
sveltePackage = nvim.types.mkGrammarOption pkgs "svelte";
|
||||
sveltePackage = mkGrammarOption pkgs "svelte";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
|
@ -73,14 +78,14 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "Svelte LSP server to use";
|
||||
type = with types; enum (attrNames servers);
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Svelte LSP server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||
type = with types; either package (listOf str);
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
|
@ -90,13 +95,13 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "Svelte formatter to use";
|
||||
type = with types; enum (attrNames formats);
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Svelte formatter package";
|
||||
type = types.package;
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -5,7 +5,11 @@
|
|||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) mkEnableOption mkOption mkIf mkMerge isList types nvim;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
|
||||
cfg = config.vim.languages.tailwind;
|
||||
|
||||
|
@ -19,7 +23,7 @@
|
|||
on_attach = default_on_attach;
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/tailwindcss-language-server", "--stdio"}''
|
||||
}
|
||||
}
|
||||
|
@ -35,14 +39,14 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "Tailwindcss LSP server to use";
|
||||
type = with types; enum (attrNames servers);
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Tailwindcss LSP server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server " - data " " ~/.cache/jdtls/workspace "]'';
|
||||
type = with types; either package (listOf str);
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) nvim mkEnableOption mkOption types mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.types) package;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.terraform;
|
||||
in {
|
||||
|
@ -13,7 +16,7 @@ in {
|
|||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Terraform treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = nvim.types.mkGrammarOption pkgs "terraform";
|
||||
package = mkGrammarOption pkgs "terraform";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
|
@ -21,7 +24,7 @@ in {
|
|||
|
||||
package = mkOption {
|
||||
description = "terraform-ls package";
|
||||
type = with types; package;
|
||||
type = package;
|
||||
default = pkgs.terraform-ls;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) attrNames;
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) enum either listOf package str;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.ts;
|
||||
|
||||
|
@ -19,7 +24,7 @@
|
|||
on_attach = attach_keymaps,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/typescript-language-server", "--stdio"}''
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +39,7 @@
|
|||
on_attach = attach_keymaps,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/deno", "lsp"}''
|
||||
}
|
||||
}
|
||||
|
@ -90,8 +95,8 @@ in {
|
|||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Typescript/Javascript treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
tsPackage = nvim.types.mkGrammarOption pkgs "tsx";
|
||||
jsPackage = nvim.types.mkGrammarOption pkgs "javascript";
|
||||
tsPackage = mkGrammarOption pkgs "tsx";
|
||||
jsPackage = mkGrammarOption pkgs "javascript";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
|
@ -99,14 +104,14 @@ in {
|
|||
|
||||
server = mkOption {
|
||||
description = "Typescript/Javascript LSP server to use";
|
||||
type = with types; enum (attrNames servers);
|
||||
type = enum (attrNames servers);
|
||||
default = defaultServer;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Typescript/Javascript LSP server package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||
type = with types; either package (listOf str);
|
||||
type = either package (listOf str);
|
||||
default = servers.${cfg.lsp.server}.package;
|
||||
};
|
||||
};
|
||||
|
@ -116,13 +121,13 @@ in {
|
|||
|
||||
type = mkOption {
|
||||
description = "Typescript/Javascript formatter to use";
|
||||
type = with types; enum (attrNames formats);
|
||||
type = enum (attrNames formats);
|
||||
default = defaultFormat;
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
description = "Typescript/Javascript formatter package";
|
||||
type = types.package;
|
||||
type = package;
|
||||
default = formats.${cfg.format.type}.package;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) isList nvim mkEnableOption mkOption types mkIf mkMerge;
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.modules) mkIf mkMerge;
|
||||
inherit (lib.lists) isList;
|
||||
inherit (lib.types) either listOf package str;
|
||||
inherit (lib.nvim.lua) expToLua;
|
||||
inherit (lib.nvim.types) mkGrammarOption;
|
||||
|
||||
cfg = config.vim.languages.zig;
|
||||
in {
|
||||
|
@ -13,7 +18,7 @@ in {
|
|||
|
||||
treesitter = {
|
||||
enable = mkEnableOption "Zig treesitter" // {default = config.vim.languages.enableTreesitter;};
|
||||
package = nvim.types.mkGrammarOption pkgs "zig";
|
||||
package = mkGrammarOption pkgs "zig";
|
||||
};
|
||||
|
||||
lsp = {
|
||||
|
@ -22,13 +27,13 @@ in {
|
|||
package = mkOption {
|
||||
description = "ZLS package, or the command to run as a list of strings";
|
||||
example = ''[lib.getExe pkgs.jdt-language-server "-data" "~/.cache/jdtls/workspace"]'';
|
||||
type = with types; either package (listOf str);
|
||||
type = either package (listOf str);
|
||||
default = pkgs.zls;
|
||||
};
|
||||
|
||||
zigPackage = mkOption {
|
||||
description = "Zig package used by ZLS";
|
||||
type = types.package;
|
||||
type = package;
|
||||
default = pkgs.zig;
|
||||
};
|
||||
};
|
||||
|
@ -47,7 +52,7 @@ in {
|
|||
on_attach=default_on_attach,
|
||||
cmd = ${
|
||||
if isList cfg.lsp.package
|
||||
then nvim.lua.expToLua cfg.lsp.package
|
||||
then expToLua cfg.lsp.package
|
||||
else ''{"${cfg.lsp.package}/bin/zls"}''
|
||||
},
|
||||
settings = {
|
||||
|
|
Loading…
Reference in a new issue