2023-11-20 04:00:33 +00:00
|
|
|
args @ { config, pkgs, lib, ... }:
|
2023-11-17 11:58:33 +00:00
|
|
|
let
|
2023-11-20 04:00:33 +00:00
|
|
|
utils = import ./utils.nix args;
|
2023-11-17 22:02:07 +00:00
|
|
|
|
2023-11-19 00:18:20 +00:00
|
|
|
lualine-nvim = {
|
|
|
|
plugin = pkgs.vimPlugins.lualine-nvim;
|
|
|
|
config = ''
|
|
|
|
require('init.evil')
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-11-18 23:08:50 +00:00
|
|
|
nvim-cmp = {
|
|
|
|
plugin = pkgs.vimPlugins.nvim-cmp;
|
|
|
|
config = ''
|
|
|
|
require('init.cmp').setup()
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-11-17 11:58:33 +00:00
|
|
|
nvim-dap = {
|
2023-11-20 04:00:33 +00:00
|
|
|
plugin = utils.pluginGit
|
2023-11-17 22:02:07 +00:00
|
|
|
"e154fdb6d70b3765d71f296e718b29d8b7026a63"
|
|
|
|
"mfussenegger/nvim-dap";
|
2023-11-17 18:00:35 +00:00
|
|
|
config = config.programs.neovim.nvim-dap;
|
2023-11-17 11:58:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nvim-lspconfig = {
|
|
|
|
plugin = pkgs.vimPlugins.nvim-lspconfig;
|
2023-11-17 18:00:35 +00:00
|
|
|
config = config.programs.neovim.nvim-lspconfig;
|
2023-11-17 11:58:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nvim-treesitter = {
|
|
|
|
plugin = (pkgs.vimPlugins.nvim-treesitter.withPlugins (
|
|
|
|
ps: with ps; [
|
|
|
|
lua
|
|
|
|
nix
|
|
|
|
python
|
|
|
|
]
|
|
|
|
));
|
|
|
|
config = ''
|
2023-11-18 23:08:50 +00:00
|
|
|
require('init.treesitter').setup()
|
2023-11-17 11:58:33 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
2023-11-17 18:00:35 +00:00
|
|
|
options.programs.neovim = {
|
|
|
|
nvim-dap = lib.mkOption {
|
|
|
|
type = lib.types.lines;
|
|
|
|
example = ''
|
|
|
|
require('...').nvim_dap()
|
|
|
|
'';
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
Language-specific configurations for the `nvim-dap` plugin.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
nvim-lspconfig = lib.mkOption {
|
|
|
|
type = lib.types.lines;
|
|
|
|
example = ''
|
|
|
|
require('...').nvim_lspconfig()
|
|
|
|
'';
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
Language-specific configurations for the `nvim-lspconfig` plugin.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
imports = [
|
2023-11-20 04:00:33 +00:00
|
|
|
./lang/lean.nix
|
2023-11-17 18:00:35 +00:00
|
|
|
./lang/lua.nix
|
|
|
|
./lang/nix.nix
|
|
|
|
./lang/python.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
config = {
|
|
|
|
programs.neovim = {
|
2023-11-18 19:45:36 +00:00
|
|
|
defaultEditor = true;
|
2023-11-17 22:02:07 +00:00
|
|
|
plugins = map (p:
|
|
|
|
if builtins.hasAttr "config" p then {
|
|
|
|
inherit (p) plugin;
|
|
|
|
config = "lua << EOF\n${p.config}\nEOF";
|
|
|
|
} else p) [
|
2023-11-19 00:18:20 +00:00
|
|
|
lualine-nvim
|
2023-11-18 23:08:50 +00:00
|
|
|
nvim-cmp
|
2023-11-17 18:00:35 +00:00
|
|
|
nvim-dap
|
|
|
|
nvim-lspconfig
|
|
|
|
nvim-treesitter
|
2023-11-18 23:08:50 +00:00
|
|
|
pkgs.vimPlugins.cmp-buffer
|
|
|
|
pkgs.vimPlugins.cmp-nvim-lsp
|
2023-11-18 23:41:39 +00:00
|
|
|
pkgs.vimPlugins.cmp_luasnip
|
|
|
|
pkgs.vimPlugins.luasnip
|
2023-11-19 00:18:20 +00:00
|
|
|
pkgs.vimPlugins.nvim-web-devicons
|
2023-11-17 18:00:35 +00:00
|
|
|
];
|
|
|
|
viAlias = true;
|
|
|
|
vimAlias = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
xdg.configFile."nvim/init.lua".text = lib.mkMerge [
|
|
|
|
# Extra Lua configuration to be prepended to `init.lua`. Extend the Lua
|
|
|
|
# loader to search for our /nix/store/.../?.lua files.
|
|
|
|
(let
|
|
|
|
lua = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "lua";
|
|
|
|
src = ./lua;
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/
|
|
|
|
cp -r ./* $out/
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in lib.mkBefore ''
|
|
|
|
package.path = '${lua}/?.lua;' .. package.path
|
|
|
|
'')
|
|
|
|
# Extra Lua configuration to be appended to `init.lua`.
|
|
|
|
(lib.mkAfter ''
|
2023-11-17 22:02:07 +00:00
|
|
|
vim.g.mapleader = ' '
|
|
|
|
vim.g.maplocalleader = '\\'
|
2023-11-17 18:00:35 +00:00
|
|
|
vim.o.colorcolumn = '80,100'
|
|
|
|
vim.o.expandtab = true -- Spaces instead of tabs.
|
2023-11-18 14:59:56 +00:00
|
|
|
vim.o.list = true -- Show hidden characters.
|
2023-11-17 18:00:35 +00:00
|
|
|
vim.o.shiftwidth = 2 -- # of spaces to use for each (auto)indent.
|
|
|
|
vim.o.tabstop = 2 -- # of spaces a <Tab> in the file counts for.
|
|
|
|
'')
|
2023-11-17 11:58:33 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|