grimm-nixos-laptop/common/tooling/nvim.nix

74 lines
1.5 KiB
Nix
Raw Normal View History

{
pkgs,
config,
lib,
...
}:
let
inherit (config.grimmShared) enable tooling;
inherit (lib)
mkOption
types
getExe
mkIf
concatLines
;
in
{
config = mkIf (enable && tooling.enable) {
environment.systemPackages = with pkgs; [
dos2unix
neovim-remote
];
programs.git.config.core.editor = getExe pkgs.neovim;
grimmShared.tooling.nvim.plugins = with pkgs.vimPlugins; [ fugitive ];
programs.neovim = {
enable = true;
viAlias = true;
defaultEditor = true;
withPython3 = true;
configure = {
customRC =
let
luarc = pkgs.writeText "init.lua" (concatLines tooling.nvim.extraLuaRC);
in
''
set number
set hidden
set fileencodings=utf-8
set nocompatible
set clipboard+=unnamedplus
set ff=unix
luafile ${luarc}
if filereadable($HOME . "/.vimrc")
source ~/.vimrc
endif
'';
packages.myVimPackage = {
start = tooling.nvim.plugins;
opt = [ ];
};
};
};
};
options.grimmShared.tooling.nvim = {
plugins = mkOption {
type = types.listOf types.package;
default = [ ];
description = "Extra vim plugins to include";
};
extraLuaRC = mkOption {
type = types.listOf types.nonEmptyStr;
default = [ ];
description = "Extra init LUA scripts";
};
};
}