nix-community.nixvim/plugins/null-ls/servers.nix

67 lines
1.6 KiB
Nix
Raw Normal View History

2022-11-15 11:36:42 +00:00
{ pkgs, config, lib, inputs, ... }@args:
let
helpers = import ./helpers.nix args;
serverData = {
code_actions = {
gitsigns = { };
};
2022-11-13 15:20:23 +00:00
completion = { };
diagnostics = {
2022-11-13 15:20:23 +00:00
flake8 = {
2023-01-17 22:14:07 +01:00
package = pkgs.python3Packages.flake8;
2022-11-13 15:20:23 +00:00
};
2022-11-15 11:36:42 +00:00
shellcheck = {
2023-01-17 22:14:07 +01:00
package = pkgs.shellcheck;
2022-11-15 11:36:42 +00:00
};
};
formatting = {
2022-10-04 13:17:56 +00:00
phpcbf = {
2023-01-17 22:14:07 +01:00
package = pkgs.phpPackages.phpcbf;
2022-10-04 13:17:56 +00:00
};
alejandra = {
2023-01-17 22:14:07 +01:00
package = pkgs.alejandra;
};
nixfmt = {
2023-01-17 22:14:07 +01:00
package = pkgs.nixfmt;
};
prettier = {
2023-01-17 22:14:07 +01:00
package = pkgs.nodePackages.prettier;
};
2022-11-13 15:20:23 +00:00
black = {
2023-01-17 22:14:07 +01:00
package = pkgs.python3Packages.black;
};
2022-11-15 11:36:42 +00:00
beautysh = {
2023-01-17 22:14:07 +01:00
package = inputs.beautysh.packages.${pkgs.system}.beautysh-python38;
2022-11-15 11:36:42 +00:00
};
2022-12-01 14:37:30 +00:00
fourmolu = {
2023-01-17 22:14:07 +01:00
package = pkgs.haskellPackages.fourmolu;
2022-12-01 14:37:30 +00:00
};
2022-12-19 02:18:15 +00:00
fnlfmt = {
2023-01-17 22:14:07 +01:00
package = pkgs.fnlfmt;
2022-12-19 02:18:15 +00:00
};
};
};
# Format the servers to be an array of attrs like the following example
# [{
# name = "prettier";
# sourceType = "formatting";
# packages = [...];
# }]
2022-11-13 15:20:23 +00:00
serverDataFormatted = lib.mapAttrsToList
(sourceType: sourceSet:
lib.mapAttrsToList (name: attrs: attrs // { inherit sourceType name; }) sourceSet
)
serverData;
dataFlattened = lib.flatten serverDataFormatted;
in
{
imports = lib.lists.map (helpers.mkServer) dataFlattened;
config = let
cfg = config.plugins.null-ls;
in
lib.mkIf cfg.enable {
plugins.gitsigns.enable = lib.mkIf (cfg.sources.code_actions.gitsigns.enable) true;
};
}