feat(nvim): add option to not install IDE stuff

This commit is contained in:
matt1432 2023-12-08 12:50:38 -05:00
parent a500d682bb
commit b04e6e5ab9
2 changed files with 114 additions and 103 deletions

View file

@ -1,31 +1,32 @@
{ {
config,
pkgs, pkgs,
lib, lib,
coc-stylelintplus-flake, coc-stylelintplus-flake,
tree-sitter-hypr-flake, tree-sitter-hypr-flake,
... ...
}: let }:
fileContents = lib.strings.fileContents; with lib; let
nvimIde = config.vars.neovimIde;
javaSdk = pkgs.temurin-bin-17; javaSdk = pkgs.temurin-bin-17;
nvim-treesitter-hypr = tree-sitter-hypr-flake.packages.${pkgs.system}.default; nvim-treesitter-hypr = tree-sitter-hypr-flake.packages.${pkgs.system}.default;
coc-stylelintplus = coc-stylelintplus-flake.packages.${pkgs.system}.default; coc-stylelintplus = coc-stylelintplus-flake.packages.${pkgs.system}.default;
in { in {
home.packages = with pkgs; [ home.packages = optionalAttrs nvimIde (with pkgs; [
gradle gradle
gradle-completion # FIXME: not working gradle-completion # FIXME: not working
alejandra alejandra
]; ]);
# TODO: make a gradle/java module xdg.dataFile = optionalAttrs nvimIde {
xdg.dataFile = {
".gradle/gradle.properties".text = '' ".gradle/gradle.properties".text = ''
org.gradle.java.home = ${javaSdk} org.gradle.java.home = ${javaSdk}
''; '';
}; };
programs = { programs = {
java = { java = optionalAttrs nvimIde {
enable = true; enable = true;
package = javaSdk; package = javaSdk;
}; };
@ -47,22 +48,24 @@ in {
viAlias = true; viAlias = true;
vimAlias = true; vimAlias = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; ([
bat
gcc
]
++ optionals nvimIde [
nodejs_latest nodejs_latest
nodePackages.npm nodePackages.npm
nodePackages.neovim nodePackages.neovim
gradle gradle
gcc
bat
nil nil
]; ]);
extraPython3Packages = ps: [
extraPython3Packages = ps:
optionals nvimIde [
ps.pylint ps.pylint
]; ];
coc = { coc = optionalAttrs nvimIde {
enable = true; enable = true;
settings = { settings = {
# General # General
@ -145,36 +148,9 @@ in {
extraConfig = fileContents ./base.vim; extraConfig = fileContents ./base.vim;
extraLuaConfig = fileContents ./base.lua; extraLuaConfig = fileContents ./base.lua;
plugins = with pkgs.vimPlugins; [ plugins = with pkgs.vimPlugins; ([
# Coc configured
coc-css
coc-eslint
coc-java
coc-sh
coc-stylelintplus
{
plugin = coc-snippets;
type = "viml";
config = fileContents ./plugins/snippets.vim;
}
## Lua
coc-sumneko-lua
neodev-nvim
## Fzf
coc-fzf
fzfWrapper fzfWrapper
fzf-vim fzf-vim
coc-highlight
coc-json
coc-pyright
coc-vimlsp
coc-yaml
coc-toml
coc-markdownlint
coc-tsserver
fugitive fugitive
{ {
@ -220,6 +196,36 @@ in {
type = "lua"; type = "lua";
config = fileContents ./plugins/mini.lua; config = fileContents ./plugins/mini.lua;
} }
]
++ optionals nvimIde [
# Coc configured
coc-css
coc-eslint
coc-java
coc-sh
coc-stylelintplus
{
plugin = coc-snippets;
type = "viml";
config = fileContents ./plugins/snippets.vim;
}
## Lua
coc-sumneko-lua
neodev-nvim
## Fzf
coc-fzf
coc-highlight
coc-json
coc-pyright
coc-vimlsp
coc-yaml
coc-toml
coc-markdownlint
coc-tsserver
{ {
plugin = neo-tree-nvim; plugin = neo-tree-nvim;
type = "viml"; type = "viml";
@ -231,7 +237,7 @@ in {
EOF EOF
''; '';
} }
]; ]);
}; };
}; };
} }

View file

@ -46,5 +46,10 @@
fontSize = mkOption { fontSize = mkOption {
type = types.nullOr types.float; type = types.nullOr types.float;
}; };
neovimIde = mkOption {
type = types.bool;
default = true;
};
}; };
} }