nix-config/home/features/coding/nvim/default.nix
GHOSCHT 7177ce3a10
Fix breakages after upgrading to NixOS 24.05
some things still have to be fixed, but normal operation can go on for
now
2024-06-29 10:10:36 +02:00

257 lines
5.3 KiB
Nix

{
config,
lib,
pkgs,
# vars,
...
}: let
vars = import ../../../../vars.nix;
colors = config.colorScheme.colors;
stableExtraPkgs = with pkgs; [
# LSP
lua-language-server
pkgs.nodePackages.typescript-language-server
# Formatters
stylua # lua
black # pyton
alejandra # nix
clang-tools_16 # c/c++
rustfmt
yamlfmt
prettierd
vscode-langservers-extracted
# Linters
ruff # python
nodePackages.jsonlint # json
nodePackages.eslint_d # javascript
# Tools
xclip
wl-clipboard
fzf
gcc
# idk?
lua
];
unstableExtraPkgs = with pkgs.unstable; [
# LSP
nixd
];
in {
home.sessionVariables.EDITOR = "nvim";
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
extraPackages = stableExtraPkgs ++ unstableExtraPkgs;
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";
}
cmp-path
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
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
]);
config = builtins.readFile ./plugin/treesitter.lua;
type = "lua";
}
vim-nix
{
plugin = base16-nvim;
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;
config = builtins.readFile ./plugin/neo-tree.lua;
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";
}
{
plugin = nvim-autopairs;
config = "require('nvim-autopairs').setup()";
type = "lua";
}
barbar-nvim
{
plugin = nvim-surround;
config = "require('nvim-surround').setup({})";
type = "lua";
}
vim-be-good
rainbow-delimiters-nvim
rustaceanvim
{
plugin = vim-tmux-navigator;
config = builtins.readFile ./plugin/vim-tmux-navigator.lua;
type = "lua";
}
{
plugin = nvim-ts-autotag;
config = "require('nvim-ts-autotag').setup({})";
type = "lua";
}
];
extraLuaConfig = ''
${builtins.readFile ./options.lua}
'';
};
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";
categories = ["Utility" "TextEditor"];
};
};
}