nix-config/home/features/coding/nvim/default.nix

244 lines
5 KiB
Nix
Raw Normal View History

2024-03-03 13:08:33 +01:00
{
config,
lib,
pkgs,
# vars,
2023-12-28 18:15:39 +01:00
...
2024-03-03 13:08:33 +01:00
}: let
2023-12-28 18:15:39 +01:00
vars = import ../../../../vars.nix;
colors = config.colorScheme.colors;
2024-05-01 14:10:56 +02:00
stableExtraPkgs = with pkgs; [
# LSP
lua-language-server
lua
# Formatters
stylua # lua
black # pyton
alejandra # nix
clang-tools_16 # c/c++
rustfmt
yamlfmt
# Linters
ruff # python
nodePackages.jsonlint # json
nodePackages.eslint_d # javascript
# Tools
xclip
wl-clipboard
fzf
gcc
];
unstableExtraPkgs = with pkgs.unstable; [
# LSP
nixd
];
2024-03-03 13:08:33 +01:00
in {
home.sessionVariables.EDITOR = "nvim";
2023-12-28 18:15:39 +01:00
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
2024-05-01 14:10:56 +02:00
extraPackages = stableExtraPkgs ++ unstableExtraPkgs;
2023-12-28 18:15:39 +01:00
plugins = with pkgs.vimPlugins; [
{
plugin = neodev-nvim;
type = "lua";
config = ''
require("neodev").setup({
override = function(root_dir, library)
if root_dir:find("/home/${vars.user + "/" + vars.dir_name}", 1, true) == 1 then
library.enabled = true
library.plugins = true
end
end,
})
'';
}
{
plugin = nvim-lspconfig;
config = builtins.readFile ./plugin/lsp.lua;
type = "lua";
}
{
plugin = comment-nvim;
config = "require('Comment').setup()";
type = "lua";
}
2024-01-07 15:32:21 +01:00
cmp-path
2023-12-28 18:15:39 +01:00
nvim-cmp
{
plugin = nvim-cmp;
config = builtins.readFile ./plugin/cmp.lua;
type = "lua";
}
{
plugin = telescope-nvim;
config = builtins.readFile ./plugin/telescope.lua;
type = "lua";
}
telescope-fzf-native-nvim
telescope-ui-select-nvim
cmp_luasnip
cmp-nvim-lsp
luasnip
friendly-snippets
{
plugin = nvim-treesitter.withPlugins (p: [
p.vim
p.bash
p.lua
p.python
p.json
p.java
p.rust
p.cpp
2024-01-07 15:33:41 +01:00
p.c
p.css
p.csv
p.dockerfile
p.diff
p.gitignore
p.git_config
p.gitattributes
p.make
p.yaml
p.toml
p.typescript
p.xml
]);
2023-12-28 18:15:39 +01:00
config = builtins.readFile ./plugin/treesitter.lua;
type = "lua";
}
vim-nix
{
plugin = nvim-base16;
config = ''
require('base16-colorscheme').setup({
base00 = '#${colors.base00}', base01 = '#${colors.base01}', base02 = '#${colors.base02}', base03 = '#${colors.base03}',
base04 = '#${colors.base04}', base05 = '#${colors.base05}', base06 = '#${colors.base06}', base07 = '#${colors.base07}',
base08 = '#${colors.base08}', base09 = '#${colors.base09}', base0A = '#${colors.base0A}', base0B = '#${colors.base0B}',
base0C = '#${colors.base0C}', base0D = '#${colors.base0D}', base0E = '#${colors.base0E}', base0F = '#${colors.base0F}',
})'';
type = "lua";
}
{
plugin = lualine-nvim;
config = builtins.readFile ./plugin/lualine.lua;
type = "lua";
}
nvim-web-devicons
plenary-nvim
nui-nvim
{
plugin = neo-tree-nvim;
2024-01-07 15:32:57 +01:00
config = builtins.readFile ./plugin/neo-tree.lua;
2023-12-28 18:15:39 +01:00
type = "lua";
}
{
plugin = gitsigns-nvim;
config = "require('gitsigns').setup()";
type = "lua";
}
diffview-nvim
lazygit-nvim
{
plugin = todo-comments-nvim;
config = builtins.readFile ./plugin/todo.lua;
type = "lua";
}
{
plugin = alpha-nvim;
config = builtins.readFile ./plugin/alpha.lua;
type = "lua";
}
{
plugin = none-ls-nvim;
config = builtins.readFile ./plugin/none-ls.lua;
type = "lua";
}
2024-01-07 15:33:29 +01:00
2024-01-07 15:33:57 +01:00
{
plugin = nvim-autopairs;
config = "require('nvim-autopairs').setup({})";
type = "lua";
}
2024-01-07 15:33:29 +01:00
{
plugin = barbar-nvim;
config = builtins.readFile ./plugin/barbar.lua;
}
2024-01-07 15:34:58 +01:00
{
plugin = nvim-surround;
config = "require('nvim-surround').setup({})";
type = "lua";
}
2024-02-02 20:04:17 +01:00
vim-be-good
2024-02-05 20:01:48 +01:00
rainbow-delimiters-nvim
2024-02-06 14:34:39 +01:00
rustaceanvim
2023-12-28 18:15:39 +01:00
];
2023-12-29 14:19:04 +01:00
extraLuaConfig = ''
${builtins.readFile ./options.lua}
'';
2023-12-28 18:15:39 +01:00
};
xdg.desktopEntries = {
nvim = {
name = "Neovim";
genericName = "Text Editor";
comment = "Edit text files";
exec = "nvim %F";
icon = "nvim";
mimeType = [
"text/english"
"text/plain"
"text/x-makefile"
"text/x-c++hdr"
"text/x-c++src"
"text/x-chdr"
"text/x-csrc"
"text/x-java"
"text/x-moc"
"text/x-pascal"
"text/x-tcl"
"text/x-tex"
"application/x-shellscript"
"text/x-c"
"text/x-c++"
];
terminal = true;
type = "Application";
2024-03-03 13:08:33 +01:00
categories = ["Utility" "TextEditor"];
};
};
2023-12-28 18:15:39 +01:00
}