2022-08-05 12:08:19 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
2022-09-18 11:19:23 +01:00
|
|
|
cfg = config.plugins.null-ls;
|
2022-08-05 12:08:19 +00:00
|
|
|
helpers = (import ../helpers.nix { inherit lib; });
|
|
|
|
in
|
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
./servers.nix
|
|
|
|
];
|
|
|
|
|
2022-09-18 11:19:23 +01:00
|
|
|
options.plugins.null-ls = {
|
2022-08-05 12:08:19 +00:00
|
|
|
enable = mkEnableOption "Enable null-ls";
|
|
|
|
|
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;
|
|
|
|
# };
|
|
|
|
};
|
|
|
|
|
2022-09-18 11:19:23 +01:00
|
|
|
config =
|
|
|
|
let
|
|
|
|
options = {
|
|
|
|
debug = cfg.debug;
|
|
|
|
sources = cfg.sourcesItems;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
mkIf cfg.enable {
|
2023-01-19 10:45:15 +00:00
|
|
|
extraPlugins = [ cfg.package ];
|
2022-08-05 12:08:19 +00:00
|
|
|
|
|
|
|
extraConfigLua = ''
|
|
|
|
require("null-ls").setup(${helpers.toLuaObject options})
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|