Compare commits

...

5 commits

Author SHA1 Message Date
f0f2c08e9f
lsp/null-ls: use string type for diagnostic format 2024-05-16 19:35:19 +03:00
cfbed8ceb1
modules/wrapper: remove redundant instances of literalExpression 2024-05-16 19:13:44 +03:00
1ce25d7ca3
modules: reorder args 2024-05-16 19:11:39 +03:00
eefc7a9d1d
lsp/null-lsp: allow null-ls options to be configured
This should probably still be converted to setupOpts. Missing docs
2024-05-16 19:11:37 +03:00
74c94b8a54
flake: fix recursive module alias 2024-05-16 19:11:36 +03:00
6 changed files with 66 additions and 37 deletions

View file

@ -47,7 +47,7 @@
nixosModules.neovim-flake has been deprecated.
Please use the nixosModules.nvf instead
''
self.nixosModules.neovim-flake;
self.nixosModules.nvf;
nvf = {
imports = [(import ./flake/modules/nixos.nix self.packages inputs)];

View file

@ -25,7 +25,7 @@ inputs: {
# check can be disabled while calling this file is called
# to avoid checking in all modules
nvimModules = import ./modules.nix {
inherit check pkgs;
inherit pkgs check;
lib = extendedLib;
};

View file

@ -1,7 +1,7 @@
{
check ? true,
pkgs,
lib,
check ? true,
}: let
inherit (lib.modules) mkDefault;
inherit (lib.lists) concatLists;

View file

@ -5,6 +5,7 @@
}: let
inherit (lib.modules) mkIf mkMerge;
inherit (lib.attrsets) mapAttrs;
inherit (lib.trivial) boolToString;
inherit (lib.nvim.dag) entryAnywhere entryAfter entryBetween;
cfg = config.vim.lsp;
@ -12,27 +13,37 @@ in {
config = mkIf cfg.null-ls.enable (mkMerge [
{
vim = {
lsp.enable = true;
startPlugins = ["none-ls"];
startPlugins = [
"none-ls"
"plenary-nvim"
];
luaConfigRC.null_ls-setup = entryAnywhere ''
# null-ls implies LSP already being set up
# since it will hook into LSPs to receive information
lsp.enable = true;
luaConfigRC = {
# early setup for null-ls
null_ls-setup = entryAnywhere ''
local null_ls = require("null-ls")
local null_helpers = require("null-ls.helpers")
local null_methods = require("null-ls.methods")
local ls_sources = {}
'';
luaConfigRC.null_ls = entryAfter ["null_ls-setup" "lsp-setup"] ''
# null-ls setup
null_ls = entryAfter ["null_ls-setup" "lsp-setup"] ''
require('null-ls').setup({
debug = false,
diagnostics_format = "[#{m}] #{s} (#{c})",
debounce = 250,
default_timeout = 5000,
debug = ${boolToString cfg.null-ls.debug},
diagnostics_format = "${cfg.null-ls.diagnostics_format}",
debounce = ${toString cfg.null-ls.debounce},
default_timeout = ${toString cfg.null-ls.default_timeout},
sources = ls_sources,
on_attach = default_on_attach
})
'';
};
};
}
{
vim.luaConfigRC = mapAttrs (_: v: (entryBetween ["null_ls"] ["null_ls-setup"] v)) cfg.null-ls.sources;

View file

@ -1,10 +1,30 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) attrsOf str;
inherit (lib.types) attrsOf str int;
in {
options.vim.lsp.null-ls = {
enable = mkEnableOption "null-ls, also enabled automatically";
debug = mkEnableOption "debugging information for `null-ls";
diagnostics_format = mkOption {
type = str;
default = "[#{m}] #{s} (#{c})";
description = "Diagnostic output format for null-ls";
};
debounce = mkOption {
type = int;
default = 250;
description = "Default debounce";
};
default_timeout = mkOption {
type = int;
default = 5000;
description = "Default timeout value, in miliseconds";
};
sources = mkOption {
description = "null-ls sources";
type = attrsOf str;

View file

@ -3,7 +3,7 @@
lib,
...
}: let
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.options) mkOption mkEnableOption literalMD;
inherit (lib.types) package bool str listOf attrsOf;
inherit (lib.nvim.types) pluginsOpt extraPluginType;
in {
@ -38,7 +38,7 @@ in {
startPlugins = pluginsOpt {
default = ["plenary-nvim"];
example = literalExpression ''
example = ''
[pkgs.vimPlugins.telescope-nvim]
'';
@ -54,7 +54,7 @@ in {
optPlugins = pluginsOpt {
default = [];
example = literalExpression ''
example = ''
[pkgs.vimPlugins.vim-ghost]
'';
description = ''
@ -80,7 +80,8 @@ in {
your custom plugins using nvf's modified DAG library.
'';
example = literalExpression ''
example = literalMD ''
```nix
with pkgs.vimPlugins; {
aerial = {
package = aerial-nvim;
@ -93,13 +94,14 @@ in {
after = ["aerial"]; # place harpoon configuration after aerial
};
}
```
'';
};
extraPackages = mkOption {
type = listOf package;
default = [];
example = literalExpression ''[pkgs.fzf pkgs.ripgrep]'';
example = ''[pkgs.fzf pkgs.ripgrep]'';
description = ''
List of additional packages to make available to the Neovim
wrapper.
@ -107,7 +109,7 @@ in {
};
# this defaults to `true` in the wrapper
# and since we passs this value to the wrapper
# and since we pass this value to the wrapper
# with an inherit, it should be `true` here as well
withRuby =
mkEnableOption ''
@ -118,29 +120,25 @@ in {
};
withNodeJs = mkEnableOption ''
NodeJs support in the Neovim wrapper.
NodeJs support in the Neovim wrapper
'';
luaPackages = mkOption {
type = listOf str;
default = [];
example = literalExpression ''["magick" "serpent"]'';
description = ''
List of lua packages to install.
'';
example = ''["magick" "serpent"]'';
description = "List of lua packages to install";
};
withPython3 = mkEnableOption ''
Python3 support in the Neovim wrapper.
Python3 support in the Neovim wrapper
'';
python3Packages = mkOption {
type = listOf str;
default = [];
example = literalExpression ''["pynvim"]'';
description = ''
List of python packages to install.
'';
example = ''["pynvim"]'';
description = "List of python packages to install";
};
};
}