From 5cb0b971cc46be8c20498199e5498ca5b749b42b Mon Sep 17 00:00:00 2001 From: matt1432 Date: Thu, 9 Jan 2025 09:56:48 -0500 Subject: [PATCH] feat(nvim): add config options to disable some LSPs --- configurations/android/nix-on-droid.nix | 6 ++++++ homeManagerModules/neovim/default.nix | 19 +++++++++++++++++++ .../neovim/langs/bash/default.nix | 2 +- .../neovim/langs/java/default.nix | 2 +- .../neovim/langs/nix-lang/default.nix | 2 +- .../neovim/langs/python/default.nix | 2 +- 6 files changed, 29 insertions(+), 4 deletions(-) diff --git a/configurations/android/nix-on-droid.nix b/configurations/android/nix-on-droid.nix index a786d29c..e081ae75 100644 --- a/configurations/android/nix-on-droid.nix +++ b/configurations/android/nix-on-droid.nix @@ -43,6 +43,12 @@ programs.neovim = { enable = true; user = "nix-on-droid"; + + ideConfig = { + enableJava = false; + enableNix= false; + enablePython = false; + }; }; } diff --git a/homeManagerModules/neovim/default.nix b/homeManagerModules/neovim/default.nix index f0054bc2..9e1a1cf9 100644 --- a/homeManagerModules/neovim/default.nix +++ b/homeManagerModules/neovim/default.nix @@ -19,6 +19,25 @@ in { user = mkOption { type = types.str; }; + + ideConfig = { + enableBash = mkOption { + type = types.bool; + default = true; + }; + enableJava = mkOption { + type = types.bool; + default = true; + }; + enableNix = mkOption { + type = types.bool; + default = true; + }; + enablePython = mkOption { + type = types.bool; + default = true; + }; + }; }; config = mkIf cfg.enable { diff --git a/homeManagerModules/neovim/langs/bash/default.nix b/homeManagerModules/neovim/langs/bash/default.nix index 19625147..302e753d 100644 --- a/homeManagerModules/neovim/langs/bash/default.nix +++ b/homeManagerModules/neovim/langs/bash/default.nix @@ -8,7 +8,7 @@ cfg = config.programs.neovim; in { - config = mkIf cfg.enable { + config = mkIf (cfg.enable && cfg.ideConfig.enableBash) { programs = { # I love doing typos bash.shellAliases = { diff --git a/homeManagerModules/neovim/langs/java/default.nix b/homeManagerModules/neovim/langs/java/default.nix index e245e7e9..22711f80 100644 --- a/homeManagerModules/neovim/langs/java/default.nix +++ b/homeManagerModules/neovim/langs/java/default.nix @@ -10,7 +10,7 @@ javaSdk = pkgs.temurin-bin-21; in { - config = mkIf cfg.enable { + config = mkIf (cfg.enable && cfg.ideConfig.enableJava) { programs = { # We keep the packages here because java is a bit complicated java = { diff --git a/homeManagerModules/neovim/langs/nix-lang/default.nix b/homeManagerModules/neovim/langs/nix-lang/default.nix index 18c79af6..67a9c3b4 100644 --- a/homeManagerModules/neovim/langs/nix-lang/default.nix +++ b/homeManagerModules/neovim/langs/nix-lang/default.nix @@ -23,7 +23,7 @@ self: { then "nixosConfigurations.${hostName}.options" else "nixOnDroidConfigurations.default"; in { - config = mkIf cfg.enable { + config = mkIf (cfg.enable && cfg.ideConfig.enableNix) { assertions = [ { assertion = hasPrefix "${mainHmCfg.home.homeDirectory}/" flakeEnv; diff --git a/homeManagerModules/neovim/langs/python/default.nix b/homeManagerModules/neovim/langs/python/default.nix index c4dd2634..738f67d0 100644 --- a/homeManagerModules/neovim/langs/python/default.nix +++ b/homeManagerModules/neovim/langs/python/default.nix @@ -15,7 +15,7 @@ }) ++ py.python-lsp-server.optional-dependencies.all; in { - config = mkIf cfg.enable { + config = mkIf (cfg.enable && cfg.ideConfig.enablePython) { programs = { neovim = { withPython3 = true;