linuxware/modules/home-manager/programs/neovim/default.nix

151 lines
3.2 KiB
Nix
Raw Normal View History

{
config,
pkgs,
lib,
...
}:
let
2025-01-16 21:03:29 -03:00
inherit (lib)
types
mkOption
mkIf
mkEnableOption
;
ollamaPackage = mkIf config.programs.neovim.ollama.enable (
if config.programs.neovim.ollama.type == "amd" then
pkgs.ollama-rocm
else if config.programs.neovim.ollama.type == "nvidia" then
pkgs.ollama-cuda
else
2025-01-16 21:03:29 -03:00
pkgs.ollama
);
in
{
options.programs.neovim = {
nixd = {
hostname = mkOption {
default = "wizdesk";
description = "Your NixOS hostname, needed for nixd lsp.";
example = "nixos";
type = types.str;
};
location = mkOption {
default = "git+file:///home/wizardlink/.system";
description = "Path to your flake location, prepend 'file:///' to it and 'git+' before that if using git.";
example = "git+file:///home/wizardlink/.system";
type = types.str;
};
};
2025-01-16 21:03:29 -03:00
ollama = {
enable = mkEnableOption "enable";
type = mkOption {
default = "amd";
description = "The type of ollama package to install, AMD GPU accelerated or NVIDIA GPU accelerated.";
example = "amd";
type = types.enum [
"amd"
"nvidia"
];
};
};
};
config = {
programs.neovim = {
withNodeJs = true;
withPython3 = true;
extraLuaConfig = builtins.readFile ./init.lua;
extraPackages = with pkgs; [
# Needed by ollama.nvim
curl
ollamaPackage
2024-12-08 19:53:05 -03:00
# Needed by LuaSnip
luajitPackages.jsregexp
# CMAKE
neocmakelsp
# C/C++
clang-tools
gcc # Needed for treesitter
vscode-extensions.ms-vscode.cpptools
2024-09-30 19:28:55 -03:00
# C#
csharp-ls
csharpier
netcoredbg
2024-09-30 19:28:55 -03:00
# HTML/CSS/JSON
emmet-ls
vscode-langservers-extracted
# LUA
lua-language-server
stylua
# Markdown
markdownlint-cli
marksman
# Nix
nixd
nixfmt-rfc-style
# Python
basedpyright
python312Packages.flake8
ruff
# TypeScript/JavaScript
2024-11-30 13:37:41 -03:00
vtsls
deno
2024-10-21 14:59:25 -03:00
vscode-js-debug
# Rust
rust-analyzer
cargo # Needed by blink-cmp
taplo
2024-10-21 14:59:25 -03:00
vscode-extensions.vadimcn.vscode-lldb
# Vue
prettierd
vue-language-server
# Svelte
nodePackages.svelte-language-server
# YAML
yaml-language-server
];
};
xdg.configFile."nvim/lua" = {
recursive = true;
source = ./lua;
};
xdg.configFile."nvim/lua/plugins/astrolsp.lua".source = pkgs.runCommand "astrolsp.lua" { } ''
cp ${./lsp.lua} $out
substituteInPlace $out \
--replace-fail "{hostname}" "${config.programs.neovim.nixd.hostname}" \
--replace-fail "{location}" "${config.programs.neovim.nixd.location}" \
--replace-fail "{pkgs.vue-language-server}" "${pkgs.vue-language-server}"
'';
xdg.configFile."nvim/lua/polish.lua".source = pkgs.runCommand "polish.lua" { } ''
cp ${./polish.lua} $out
substituteInPlace $out \
--replace-fail "{pkgs.vscode-extensions.ms-vscode.cpptools}" "${pkgs.vscode-extensions.ms-vscode.cpptools}" \
'';
};
}