From cc7d62745c6c642b5e514110f27288613e92bd4c Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Tue, 11 Jun 2024 19:43:48 +0200 Subject: [PATCH] Use native toml format instead of handrolling --- home/modules/programs/my-kakoune/kak-lsp.nix | 32 +++++++++----------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/home/modules/programs/my-kakoune/kak-lsp.nix b/home/modules/programs/my-kakoune/kak-lsp.nix index dccfc17..83bec33 100644 --- a/home/modules/programs/my-kakoune/kak-lsp.nix +++ b/home/modules/programs/my-kakoune/kak-lsp.nix @@ -193,29 +193,27 @@ in }; }; - config = mkIf cfg.enable { - home.packages = [ cfg.package ]; + config = mkIf cfg.enable + { + home.packages = [ cfg.package ]; - # Configurations - xdg.configFile."kak-lsp/kak-lsp.toml" = { - source = pkgs.runCommand "config.toml" + # Configurations + xdg.configFile."kak-lsp/kak-lsp.toml" = + let + toml = pkgs.formats.toml { }; + stripNulls = lib.filterAttrsRecursive (n: v: v != null); + in { - buildInputs = [ pkgs.yj ]; - preferLocalBuild = true; - } '' - yj -jt -i \ - < ${ - pkgs.writeText "config.json" (builtins.toJSON { + source = toml.generate "config.toml" + { semantic_tokens.faces = cfg.semanticTokens.faces ++ cfg.semanticTokens.additionalFaces; server.timeout = cfg.serverTimeout; snippet_support = cfg.enableSnippets; verbosity = 255; - language_server = lspConfig.language_servers // cfg.languageServers; + language_server = stripNulls (lspConfig.language_servers // cfg.languageServers); language_ids = lspConfig.language_ids // cfg.languageIds; - }) - } \ - > $out - ''; + }; + }; }; - }; } +