flake/homes/modules/editor/neovim/default.nix

237 lines
5.4 KiB
Nix
Raw Normal View History

2026-02-27 16:49:15 +10:00
# TODO: look into changing to this:
# https://github.com/BirdeeHub/nix-wrapper-modules
{
inputs,
2026-03-21 10:25:31 +10:00
lib,
2026-02-27 16:49:15 +10:00
...
}: let
inherit
(inputs.nixcats)
utils
;
in {
imports = [
inputs.nixcats.homeModule
];
2026-03-21 10:25:31 +10:00
nixCats = {
enable = true;
nixpkgs_version = inputs.nixpkgs-unstable;
addOverlays =
[
(utils.standardPluginOverlay inputs)
]
++ lib.optional (builtins.pathExists ./overlays.nix) ./overlays.nix;
2026-02-27 16:49:15 +10:00
2026-03-21 10:25:31 +10:00
# see the packageDefinitions below.
# This says which of those to install.
packageNames = ["cryvim"];
2026-02-27 16:49:15 +10:00
2026-03-21 10:25:31 +10:00
luaPath = ./.;
2026-02-27 16:49:15 +10:00
2026-03-21 10:25:31 +10:00
# NOTE: the .replace vs .merge options are for modules based on existing configurations,
# NOTE: they refer to how multiple categoryDefinitions get merged together by the module.
# NOTE: for useage of this section, refer to :h nixCats.flake.outputs.categories
categoryDefinitions.replace = {
pkgs,
settings,
categories,
extra,
name,
mkNvimPlugin,
...
} @ packageDef: {
lspsAndRuntimeDeps = with pkgs; {
general = [
ripgrep
fd
];
treesitter = [
tree-sitter
];
lang = {
lua = [
lua-language-server
stylua
2026-02-27 16:49:15 +10:00
];
2026-03-21 10:25:31 +10:00
nix = [
nil
nix-doc # TODO: i forgot what this is for
nixfmt
2026-02-27 16:49:15 +10:00
];
2026-03-21 10:25:31 +10:00
rust = [
rust-analyzer
rustfmt
2026-02-27 16:49:15 +10:00
];
2026-03-21 10:25:31 +10:00
zig = [
zls
2026-02-27 16:49:15 +10:00
];
2026-03-21 10:25:31 +10:00
elixir = [
elixir-ls
2026-02-27 16:49:15 +10:00
];
2026-03-21 10:25:31 +10:00
gleam = [
gleam
2026-02-27 16:49:15 +10:00
];
2026-03-21 10:25:31 +10:00
haskell = [
haskell-language-server
ormolu
2026-02-27 16:49:15 +10:00
];
2026-03-21 10:25:31 +10:00
java = [
jdt-language-server
javaPackages.compiler.openjdk17
javaPackages.compiler.openjdk21
2026-02-27 16:49:15 +10:00
];
2026-03-21 10:25:31 +10:00
protobuf = [
protols
buf
2026-02-27 16:49:15 +10:00
];
};
2026-03-21 10:25:31 +10:00
};
2026-02-27 16:49:15 +10:00
2026-03-21 10:25:31 +10:00
startupPlugins = with pkgs.vimPlugins; {
general = [
lze
plenary-nvim
nvim-notify
nvim-web-devicons
base16-nvim
mini-nvim
];
treesitter = [
nvim-treesitter-textobjects
nvim-treesitter.withAllGrammars
];
};
optionalPlugins = with pkgs.vimPlugins; {
general = [
];
ui = [
dressing-nvim
];
qol = [
undotree
mini-hipatterns
];
telescope = [
telescope-nvim
telescope-fzf-native-nvim
telescope-ui-select-nvim
];
fyler = [
fyler-nvim
];
lsp = [
nvim-lspconfig
];
completion = [
blink-cmp
nvim-cmp
luasnip
friendly-snippets
cmp_luasnip
cmp-buffer
cmp-path
cmp-nvim-lua
cmp-nvim-lsp
cmp-cmdline
cmp-nvim-lsp-signature-help
cmp-cmdline-history
lspkind-nvim
];
format = [
conform-nvim
];
comment = [
comment-nvim
];
lang = {
java = [
nvim-jdtls
2026-02-27 16:49:15 +10:00
];
};
2026-03-21 10:25:31 +10:00
};
2026-02-27 16:49:15 +10:00
2026-03-21 10:25:31 +10:00
# shared libraries to be added to nvim runtime's LD_LIBRARY_PATH
sharedLibraries = {
general = with pkgs; [
# libgit2
];
};
environmentVariables = {
lang = {
rust.lsp = {
# it literally won't see the rust-analyzer provided to it
RUST_ANALYZER_CMD = "${pkgs.rust-analyzer}/bin/rust-analyzer";
};
elixir.lsp = {
ELIXIR_LS_CMD = "${pkgs.elixir-ls}/scripts/language_server.sh";
};
java.lsp = {
JAVA_HOME = "${pkgs.javaPackages.compiler.openjdk17}";
OPENJDK_17 = "${pkgs.javaPackages.compiler.openjdk17}";
OPENJDK_21 = "${pkgs.javaPackages.compiler.openjdk21}";
2026-02-27 16:49:15 +10:00
};
};
2026-03-21 10:25:31 +10:00
};
2026-02-27 16:49:15 +10:00
2026-03-21 10:25:31 +10:00
extraWrapperArgs = {};
# lists of the functions you would have passed to
# python.withPackages or lua.withPackages
2026-02-27 16:49:15 +10:00
2026-03-21 10:25:31 +10:00
# get the path to this python environment
# in your lua config via
# vim.g.python3_host_prog
# or run from nvim terminal via :!<packagename>-python3
extraPython3Packages = {};
# populates $LUA_PATH and $LUA_CPATH
extraLuaPackages = {};
};
2026-02-27 16:49:15 +10:00
2026-03-21 10:25:31 +10:00
# REF: :help nixCats.flake.outputs.packageDefinitions
packageDefinitions.replace = {
# these are the names of your packages
# you can include as many as you wish.
cryvim = {pkgs, ...}: {
# they contain a settings set defined above
# REF: :help nixCats.flake.outputs.settings
settings = {
wrapRc = true;
aliases = [
"ce"
];
};
2026-02-27 16:49:15 +10:00
2026-03-21 10:25:31 +10:00
# and a set of categories that you want
# (and other information to pass to lua)
categories = {
general = true;
2026-02-27 16:49:15 +10:00
2026-03-21 10:25:31 +10:00
ui = true;
qol = true;
telescope = true;
fyler = true;
lsp = true;
completion = true;
treesitter = true;
format = true;
comment = true;
lang = {
lua = true;
nix = true;
rust = true;
zig = true;
elixir = true;
gleam = true;
haskell = true;
java = true;
protobuf = true;
2026-02-27 16:49:15 +10:00
};
};
};
};
};
}