2022-08-05 12:08:19 +00:00
|
|
|
{
|
2023-02-20 11:42:13 +01:00
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.plugins.null-ls;
|
|
|
|
helpers = import ../helpers.nix {inherit lib;};
|
|
|
|
in {
|
2022-08-05 12:08:19 +00:00
|
|
|
imports = [
|
|
|
|
./servers.nix
|
|
|
|
];
|
|
|
|
|
2022-09-18 11:19:23 +01:00
|
|
|
options.plugins.null-ls = {
|
2023-01-22 03:32:08 +00:00
|
|
|
enable = mkEnableOption "null-ls";
|
2022-08-05 12:08:19 +00:00
|
|
|
|
2023-01-19 10:45:15 +00:00
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.vimPlugins.null-ls-nvim;
|
|
|
|
description = "Plugin to use for null-ls";
|
|
|
|
};
|
|
|
|
|
2022-08-05 12:08:19 +00:00
|
|
|
debug = mkOption {
|
|
|
|
default = null;
|
|
|
|
type = with types; nullOr bool;
|
|
|
|
};
|
|
|
|
|
|
|
|
sourcesItems = mkOption {
|
|
|
|
default = null;
|
|
|
|
# type = with types; nullOr (either (listOf str) (listOf attrsOf str));
|
|
|
|
type = with types; nullOr (listOf (attrsOf str));
|
|
|
|
description = "The list of sources to enable, should be strings of lua code. Don't use this directly";
|
|
|
|
};
|
|
|
|
|
|
|
|
# sources = mkOption {
|
|
|
|
# default = null;
|
|
|
|
# type = with types; nullOr attrs;
|
|
|
|
# };
|
|
|
|
};
|
|
|
|
|
2023-02-20 11:42:13 +01:00
|
|
|
config = let
|
|
|
|
options = {
|
|
|
|
debug = cfg.debug;
|
|
|
|
sources = cfg.sourcesItems;
|
|
|
|
};
|
|
|
|
in
|
2022-09-18 11:19:23 +01:00
|
|
|
mkIf cfg.enable {
|
2023-02-20 11:42:13 +01:00
|
|
|
extraPlugins = [cfg.package];
|
2022-08-05 12:08:19 +00:00
|
|
|
|
|
|
|
extraConfigLua = ''
|
|
|
|
require("null-ls").setup(${helpers.toLuaObject options})
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|