nix-community.nixvim/plugins/none-ls/servers.nix
Matt Sturgeon d8f3113e90
plugins/none-ls: refactor using mkSourcePlugin
Introduce `_mk-source-plugin.nix`, which returns a module handling a
specific none-ls source plugin.

This wasn't possible previously due to IFD conflicting with evaluating
module imports.

Adjusted the test to use the `options` provided via module args, and
cleaned up some stuff allowing "unpackaged" sources to not be listed
again in the test file.
2024-07-13 20:11:09 +01:00

22 lines
575 B
Nix

{ config, lib, ... }:
let
noneLsBuiltins = import ../../generated/none-ls.nix;
mkSourcePlugin = import ./_mk-source-plugin.nix;
in
{
imports =
[ ./prettier.nix ]
++ (lib.flatten (
lib.mapAttrsToList (category: (lib.map (mkSourcePlugin category))) noneLsBuiltins
));
config =
let
cfg = config.plugins.none-ls;
gitsignsEnabled = cfg.sources.code_actions.gitsigns.enable;
in
lib.mkIf cfg.enable {
# Enable gitsigns if the gitsigns source is enabled
plugins.gitsigns.enable = lib.mkIf gitsignsEnabled true;
};
}