null-ls: init with prettier and flake8 (#31)

This commit is contained in:
Alexander Nortung 2022-08-05 12:08:19 +00:00 committed by GitHub
parent f12a79bda6
commit 5cb317a5cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 128 additions and 0 deletions

View file

@ -0,0 +1,33 @@
{ pkgs, config, lib, ... }@args:
let
helpers = import ./helpers.nix args;
serverData = {
code_actions = {
};
completion = {
};
diagnostics = {
};
formatting = {
prettier = {
packages = [ pkgs.nodePackages.prettier ];
};
flake8 = {
packages = [ pkgs.python3Packages.flake8 ];
};
};
};
# Format the servers to be an array of attrs like the following example
# [{
# name = "prettier";
# sourceType = "formatting";
# packages = [...];
# }]
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;
}