From 3ca97bccbc01e118aea298f0c01e24b6cb3a17df Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Thu, 14 Sep 2023 23:55:11 +0200 Subject: [PATCH] feat: make rust lsp install optional --- modules/languages/rust.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/languages/rust.nix b/modules/languages/rust.nix index 21ab58d..b3ad758 100644 --- a/modules/languages/rust.nix +++ b/modules/languages/rust.nix @@ -30,7 +30,7 @@ in { package = mkOption { description = "rust-analyzer package"; - type = types.package; + type = with types; either package (listOf str); default = pkgs.rust-analyzer; }; @@ -118,7 +118,11 @@ in { server = { capabilities = capabilities, on_attach = rust_on_attach, - cmd = {"${cfg.lsp.package}/bin/rust-analyzer"}, + cmd = ${ + if isList cfg.lsp.package + then nvim.lua.expToLua cfg.lsp.package + else ''{"${cfg.lsp.package}/bin/rust-analyzer"}'' + }, settings = { ${cfg.lsp.opts} }