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