plugins/null-ls: migrate null-ls to none-ls

This commit is contained in:
siph 2023-10-13 11:43:42 -06:00 committed by Gaétan Lepage
parent 3c4ac5ba0d
commit 56f46166f9
5 changed files with 21 additions and 16 deletions

View file

@ -72,7 +72,7 @@
./lsp/nvim-lightbulb.nix ./lsp/nvim-lightbulb.nix
./lsp/trouble.nix ./lsp/trouble.nix
./null-ls ./none-ls
./dap ./dap

View file

@ -5,22 +5,27 @@
... ...
}: }:
with lib; let with lib; let
cfg = config.plugins.null-ls; cfg = config.plugins.none-ls;
helpers = import ../helpers.nix {inherit lib;}; helpers = import ../helpers.nix {inherit lib;};
in { in {
imports = [ imports = [
./servers.nix ./servers.nix
(
mkRenamedOptionModule
["plugins" "null-ls"]
["plugins" "none-ls"]
)
]; ];
options.plugins.null-ls = options.plugins.none-ls =
helpers.extraOptionsOptions helpers.extraOptionsOptions
// { // {
enable = mkEnableOption "null-ls"; enable = mkEnableOption "none-ls";
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = pkgs.vimPlugins.null-ls-nvim; default = pkgs.vimPlugins.none-ls-nvim;
description = "Plugin to use for null-ls"; description = "Plugin to use for none-ls";
}; };
border = helpers.defaultNullOpts.mkBorder "null" "`:NullLsInfo` UI window." '' border = helpers.defaultNullOpts.mkBorder "null" "`:NullLsInfo` UI window." ''

View file

@ -7,7 +7,7 @@
mkServer = { mkServer = {
name, name,
sourceType, sourceType,
description ? "${name} source, for null-ls.", description ? "${name} source, for none-ls.",
package ? null, package ? null,
extraPackages ? [], extraPackages ? [],
... ...
@ -21,7 +21,7 @@
} @ args: } @ args:
with lib; let with lib; let
helpers = import ../helpers.nix args; helpers = import ../helpers.nix args;
cfg = config.plugins.null-ls.sources.${sourceType}.${name}; cfg = config.plugins.none-ls.sources.${sourceType}.${name};
# does this evaluate package? # does this evaluate package?
packageOption = packageOption =
if package == null if package == null
@ -30,11 +30,11 @@
package = mkOption { package = mkOption {
type = types.package; type = types.package;
default = package; default = package;
description = "Package to use for ${name} by null-ls"; description = "Package to use for ${name} by none-ls";
}; };
}; };
in { in {
options.plugins.null-ls.sources.${sourceType}.${name} = options.plugins.none-ls.sources.${sourceType}.${name} =
{ {
enable = mkEnableOption description; enable = mkEnableOption description;
@ -56,7 +56,7 @@
extraPackages = extraPackages ++ optional (package != null) cfg.package; extraPackages = extraPackages ++ optional (package != null) cfg.package;
# Add source to list of sources # Add source to list of sources
plugins.null-ls.sourcesItems = let plugins.none-ls.sourcesItems = let
sourceItem = "${sourceType}.${name}"; sourceItem = "${sourceType}.${name}";
withArgs = withArgs =
if (cfg.withArgs == null) if (cfg.withArgs == null)

View file

@ -161,7 +161,7 @@ in {
imports = lib.lists.map helpers.mkServer dataFlattened; imports = lib.lists.map helpers.mkServer dataFlattened;
config = let config = let
cfg = config.plugins.null-ls; cfg = config.plugins.none-ls;
gitsignsEnabled = cfg.sources.code_actions.gitsigns.enable; gitsignsEnabled = cfg.sources.code_actions.gitsigns.enable;
in in
lib.mkIf cfg.enable { lib.mkIf cfg.enable {

View file

@ -1,21 +1,21 @@
{ {
# Empty configuration # Empty configuration
empty = { empty = {
plugins.null-ls.enable = true; plugins.none-ls.enable = true;
}; };
# Broken: # Broken:
# error: The option `plugins.null-ls.sources.formatting.beautysh' does not exist. # error: The option `plugins.none-ls.sources.formatting.beautysh' does not exist.
# #
# beautysh = { # beautysh = {
# plugins.null-ls = { # plugins.none-ls = {
# enable = true; # enable = true;
# sources.formatting.beautysh.enable = true; # sources.formatting.beautysh.enable = true;
# }; # };
# }; # };
default = { default = {
plugins.null-ls = { plugins.none-ls = {
enable = true; enable = true;
border = null; border = null;
cmd = ["nvim"]; cmd = ["nvim"];