added formatter + reformat existing codebase (#175)

This commit is contained in:
Gaétan Lepage 2023-02-20 11:42:13 +01:00 committed by GitHub
parent 0bf4313f22
commit 264de8cefb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
96 changed files with 3727 additions and 3341 deletions

View file

@ -1,51 +1,65 @@
{ pkgs, config, lib, ... }:
{
mkLsp =
{ name
, description ? "Enable ${name}."
, serverName ? name
, package ? pkgs.${name}
, extraPackages ? { }
, cmd ? (cfg: null)
, settings ? (cfg: { })
, settingsOptions ? { }
, ...
}:
# returns a module
{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.plugins.lsp.servers.${name};
pkgs,
config,
lib,
...
}: {
mkLsp = {
name,
description ? "Enable ${name}.",
serverName ? name,
package ? pkgs.${name},
extraPackages ? {},
cmd ? (cfg: null),
settings ? (cfg: {}),
settingsOptions ? {},
...
}:
# returns a module
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.plugins.lsp.servers.${name};
packageOption =
if package != null then {
package = mkOption {
default = package;
type = types.nullOr types.package;
};
} else { };
in
{
options = {
plugins.lsp.servers.${name} = {
packageOption =
if package != null
then {
package = mkOption {
default = package;
type = types.nullOr types.package;
};
}
else {};
in {
options = {
plugins.lsp.servers.${name} =
{
enable = mkEnableOption description;
settings = settingsOptions;
} // packageOption;
};
}
// packageOption;
};
config = mkIf cfg.enable
{
extraPackages = (optional (package != null) cfg.package) ++
(mapAttrsToList (name: _: cfg."${name}Package") extraPackages);
config =
mkIf cfg.enable
{
extraPackages =
(optional (package != null) cfg.package)
++ (mapAttrsToList (name: _: cfg."${name}Package") extraPackages);
plugins.lsp.enabledServers = [{
plugins.lsp.enabledServers = [
{
name = serverName;
extraOptions = {
cmd = cmd cfg;
settings = settings cfg.settings;
};
}];
};
};
}
];
};
};
}