2022-08-02 18:48:28 +00:00
|
|
|
{ pkgs, config, lib, ... }:
|
2021-12-06 22:35:29 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
customPlugins = import ./plugins.nix { inherit pkgs; };
|
2021-12-27 20:24:11 +00:00
|
|
|
|
2021-12-30 21:36:35 +00:00
|
|
|
nvim-spell-directory = "${config.xdg.configHome}/nvim/spell";
|
2021-12-06 22:35:29 +00:00
|
|
|
in
|
|
|
|
{
|
|
|
|
programs.neovim = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs.neovim-nightly;
|
|
|
|
|
2021-12-07 15:23:17 +00:00
|
|
|
withNodeJs = false;
|
|
|
|
withRuby = false;
|
|
|
|
withPython3 = false;
|
|
|
|
|
2021-12-06 22:35:29 +00:00
|
|
|
extraConfig = ''
|
2022-03-12 19:46:27 +00:00
|
|
|
lua << EOF
|
2022-08-26 22:07:22 +00:00
|
|
|
require('nifoc.nix')
|
2022-03-12 19:46:27 +00:00
|
|
|
require('impatient')
|
2022-04-05 19:57:44 +00:00
|
|
|
require('configuration.init')
|
2022-03-12 19:46:27 +00:00
|
|
|
EOF
|
2021-12-06 22:35:29 +00:00
|
|
|
'';
|
|
|
|
|
2022-08-13 20:04:34 +00:00
|
|
|
extraLuaPackages = with pkgs; [ luarocks-jsregexp ];
|
|
|
|
|
2021-12-06 22:35:29 +00:00
|
|
|
extraPackages = with pkgs; [
|
2022-02-03 22:35:52 +00:00
|
|
|
git
|
2022-05-04 13:02:31 +00:00
|
|
|
nodejs
|
2021-12-06 22:35:29 +00:00
|
|
|
tree-sitter
|
2022-06-13 19:58:46 +00:00
|
|
|
fd
|
2022-02-12 22:13:58 +00:00
|
|
|
ripgrep
|
2021-12-06 22:35:29 +00:00
|
|
|
|
|
|
|
# LSP
|
|
|
|
nodePackages.bash-language-server
|
|
|
|
nodePackages.dockerfile-language-server-nodejs
|
2022-05-04 13:02:31 +00:00
|
|
|
nodePackages.svelte-language-server
|
2021-12-20 17:43:23 +00:00
|
|
|
nodePackages.typescript-language-server
|
2021-12-06 22:35:29 +00:00
|
|
|
nodePackages.vscode-langservers-extracted
|
|
|
|
nodePackages.yaml-language-server
|
|
|
|
rnix-lsp
|
|
|
|
sqls
|
2021-12-27 23:52:34 +00:00
|
|
|
sumneko-lua-language-server
|
2021-12-06 22:35:29 +00:00
|
|
|
taplo-lsp
|
|
|
|
|
2022-04-24 18:09:54 +00:00
|
|
|
# Diagnostic Tools
|
2022-04-09 15:39:52 +00:00
|
|
|
deadnix
|
2021-12-06 22:35:29 +00:00
|
|
|
hadolint
|
2022-04-20 14:27:26 +00:00
|
|
|
fennel-luajit
|
2022-04-05 19:57:44 +00:00
|
|
|
fnlfmt
|
2021-12-06 22:35:29 +00:00
|
|
|
shellcheck
|
|
|
|
shfmt
|
2021-12-18 23:25:21 +00:00
|
|
|
statix
|
2022-06-18 23:39:25 +00:00
|
|
|
vale
|
2022-08-24 23:12:41 +00:00
|
|
|
yamllint
|
2021-12-06 22:35:29 +00:00
|
|
|
];
|
|
|
|
|
2022-04-01 23:17:03 +00:00
|
|
|
plugins = (with customPlugins; [
|
2021-12-06 22:35:29 +00:00
|
|
|
# Fixes
|
2021-12-16 20:13:07 +00:00
|
|
|
impatient-nvim
|
2021-12-06 22:35:29 +00:00
|
|
|
|
|
|
|
# Utils
|
|
|
|
popup-nvim
|
|
|
|
plenary-nvim
|
2022-05-31 13:46:32 +00:00
|
|
|
nvim-web-devicons
|
2021-12-06 22:35:29 +00:00
|
|
|
|
|
|
|
# Keybindings
|
2022-08-02 20:50:56 +00:00
|
|
|
{
|
|
|
|
plugin = nvim-osc52;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/osc52.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
2022-04-05 19:57:44 +00:00
|
|
|
{
|
2022-04-09 23:07:36 +00:00
|
|
|
plugin = yanky-nvim;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/yanky.fnl;
|
2022-04-05 19:57:44 +00:00
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
2022-04-09 23:07:36 +00:00
|
|
|
{
|
|
|
|
plugin = cutlass-nvim;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/cutlass.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
plugin = substitute-nvim;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/substitute.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
2022-04-05 19:57:44 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
plugin = leap-nvim;
|
|
|
|
config = ''
|
|
|
|
(let [leap (require :leap)]
|
|
|
|
(leap.set_default_keymaps))
|
|
|
|
'';
|
|
|
|
type = "fennel";
|
|
|
|
}
|
2021-12-06 22:35:29 +00:00
|
|
|
|
|
|
|
# Themes
|
2022-04-16 22:24:03 +00:00
|
|
|
dracula-nvim
|
2021-12-06 22:35:29 +00:00
|
|
|
|
|
|
|
# Syntax
|
2022-08-27 17:02:39 +00:00
|
|
|
{
|
|
|
|
plugin = nvim-treesitter.withPlugins (
|
|
|
|
plugins: with plugins; [
|
|
|
|
tree-sitter-bash
|
|
|
|
tree-sitter-comment
|
|
|
|
tree-sitter-css
|
|
|
|
tree-sitter-dockerfile
|
|
|
|
tree-sitter-elixir
|
|
|
|
tree-sitter-erlang
|
|
|
|
tree-sitter-fennel
|
|
|
|
tree-sitter-fish
|
|
|
|
tree-sitter-heex
|
|
|
|
tree-sitter-html
|
|
|
|
tree-sitter-http
|
|
|
|
tree-sitter-javascript
|
|
|
|
tree-sitter-jsdoc
|
|
|
|
tree-sitter-json
|
|
|
|
tree-sitter-lua
|
|
|
|
tree-sitter-make
|
2022-09-02 20:14:05 +00:00
|
|
|
tree-sitter-markdown
|
|
|
|
tree-sitter-markdown-inline
|
2022-08-27 17:02:39 +00:00
|
|
|
tree-sitter-nix
|
|
|
|
tree-sitter-query
|
|
|
|
tree-sitter-regex
|
|
|
|
tree-sitter-ruby
|
|
|
|
tree-sitter-scss
|
|
|
|
tree-sitter-svelte
|
|
|
|
tree-sitter-toml
|
|
|
|
tree-sitter-tsx
|
|
|
|
tree-sitter-typescript
|
|
|
|
tree-sitter-vim
|
|
|
|
tree-sitter-yaml
|
|
|
|
]
|
|
|
|
);
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/treesitter.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
2022-04-05 19:57:44 +00:00
|
|
|
nvim-ts-rainbow
|
2021-12-06 22:35:29 +00:00
|
|
|
playground
|
|
|
|
|
|
|
|
# Telescope
|
2022-04-05 19:57:44 +00:00
|
|
|
{
|
|
|
|
plugin = telescope-nvim;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/telescope.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
2022-02-13 20:58:18 +00:00
|
|
|
telescope-zf-native-nvim
|
2022-06-05 20:50:28 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
plugin = project-nvim;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/project.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
plugin = todo-comments-nvim;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/todo-comments.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
2022-03-17 09:33:08 +00:00
|
|
|
telescope-ui-select-nvim
|
2022-04-21 16:55:35 +00:00
|
|
|
telescope-toggleterm-nvim
|
2021-12-06 22:35:29 +00:00
|
|
|
|
|
|
|
# LSP
|
2022-04-05 19:57:44 +00:00
|
|
|
{
|
|
|
|
plugin = nvim-lspconfig;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/lsp.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
2022-05-31 13:46:32 +00:00
|
|
|
lspkind-nvim
|
|
|
|
|
|
|
|
{
|
|
|
|
plugin = vim-illuminate;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/illuminate.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
2022-04-19 12:56:22 +00:00
|
|
|
# Linter
|
2022-04-06 14:26:01 +00:00
|
|
|
{
|
2022-04-19 12:56:22 +00:00
|
|
|
plugin = nvim-lint;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/nvim-lint.fnl;
|
2022-04-06 14:26:01 +00:00
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
2022-05-31 13:46:32 +00:00
|
|
|
# Comments
|
|
|
|
{
|
|
|
|
plugin = comment-nvim;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/comment.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
2022-04-15 20:43:51 +00:00
|
|
|
# Snippets
|
|
|
|
{
|
|
|
|
plugin = LuaSnip;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/luasnip.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
2022-05-31 13:46:32 +00:00
|
|
|
friendly-snippets
|
|
|
|
|
2021-12-06 22:35:29 +00:00
|
|
|
# cmp
|
2022-04-05 19:57:44 +00:00
|
|
|
{
|
|
|
|
plugin = nvim-cmp;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/cmp.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
2021-12-06 22:35:29 +00:00
|
|
|
cmp-nvim-lsp
|
2021-12-19 20:32:20 +00:00
|
|
|
cmp-nvim-lsp-signature-help
|
2022-04-15 20:43:51 +00:00
|
|
|
cmp_luasnip
|
2021-12-06 22:35:29 +00:00
|
|
|
cmp-nvim-lua
|
|
|
|
cmp-path
|
|
|
|
cmp-buffer
|
|
|
|
cmp-treesitter
|
|
|
|
cmp-cmdline
|
|
|
|
cmp-nvim-lsp-document-symbol
|
|
|
|
|
2022-05-31 13:46:32 +00:00
|
|
|
# Formatting
|
|
|
|
{
|
|
|
|
plugin = neoformat;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/neoformat.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
2021-12-06 22:35:29 +00:00
|
|
|
# Pairs
|
2022-04-05 19:57:44 +00:00
|
|
|
{
|
|
|
|
plugin = nvim-autopairs;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/autopairs.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
2021-12-06 22:35:29 +00:00
|
|
|
|
2022-04-05 19:57:44 +00:00
|
|
|
{
|
|
|
|
plugin = nvim-ts-autotag;
|
|
|
|
config = ''
|
|
|
|
(let [ts-autotag (require :nvim-ts-autotag)]
|
|
|
|
(ts-autotag.setup))
|
|
|
|
'';
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
plugin = vim-matchup;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/matchup.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
2021-12-06 22:35:29 +00:00
|
|
|
|
|
|
|
# Textobjects
|
|
|
|
nvim-treesitter-textobjects
|
|
|
|
|
2022-07-19 21:30:12 +00:00
|
|
|
{
|
|
|
|
plugin = nvim-surround;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/surround.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
2021-12-06 22:35:29 +00:00
|
|
|
# UI
|
2022-04-05 19:57:44 +00:00
|
|
|
{
|
2022-05-25 18:19:11 +00:00
|
|
|
plugin = heirline-nvim;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/heirline.fnl;
|
2022-04-05 19:57:44 +00:00
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
plugin = indent-blankline-nvim;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/indent_line.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
plugin = virt-column-nvim;
|
|
|
|
config = ''
|
|
|
|
(let [virt-column (require :virt-column)]
|
|
|
|
(virt-column.setup))
|
|
|
|
'';
|
|
|
|
type = "fennel";
|
2022-04-27 20:17:26 +00:00
|
|
|
}
|
|
|
|
|
2022-05-31 13:46:32 +00:00
|
|
|
{
|
|
|
|
plugin = toggleterm-nvim;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/toggleterm.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
2022-04-27 20:17:26 +00:00
|
|
|
{
|
|
|
|
plugin = urlview-nvim;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/urlview.fnl;
|
|
|
|
type = "fennel";
|
2022-04-05 19:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
plugin = gitsigns-nvim;
|
|
|
|
config = builtins.readFile ../../config/nvim/plugins/gitsigns.fnl;
|
|
|
|
type = "fennel";
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
plugin = nvim-notify;
|
2022-05-04 13:02:31 +00:00
|
|
|
config = builtins.readFile ../../config/nvim/plugins/notify.fnl;
|
2022-04-05 19:57:44 +00:00
|
|
|
type = "fennel";
|
|
|
|
}
|
2022-04-01 23:17:03 +00:00
|
|
|
]) ++ (with pkgs.vimPlugins; [
|
|
|
|
# Fixes
|
|
|
|
FixCursorHold-nvim
|
|
|
|
|
|
|
|
# UI
|
|
|
|
undotree
|
|
|
|
]);
|
2021-12-06 22:35:29 +00:00
|
|
|
};
|
|
|
|
|
2022-04-05 21:13:56 +00:00
|
|
|
xdg.configFile."nvim" = {
|
2022-04-15 20:43:51 +00:00
|
|
|
source = pkgs.runCommand "nvim-fennel-files"
|
2022-04-05 19:57:44 +00:00
|
|
|
{
|
2022-04-20 14:27:26 +00:00
|
|
|
nativeBuildInputs = with pkgs; [ fennel-luajit stylua ];
|
2022-04-05 19:57:44 +00:00
|
|
|
} ''
|
2022-04-05 21:13:56 +00:00
|
|
|
mkdir -p $out/lua/configuration
|
|
|
|
mkdir -p $out/lua/nifoc/utils
|
|
|
|
mkdir -p $out/after/ftplugin
|
2022-04-05 19:57:44 +00:00
|
|
|
|
2022-04-05 21:13:56 +00:00
|
|
|
config_store_path="${../../config/nvim}"
|
2022-05-12 19:49:19 +00:00
|
|
|
fennel="fennel --use-bit-lib --compile"
|
|
|
|
|
|
|
|
echo "Using fennel command: $fennel"
|
|
|
|
|
|
|
|
# Change PWD to config directory
|
|
|
|
cd "$config_store_path"
|
2022-04-05 19:57:44 +00:00
|
|
|
|
2022-04-05 21:13:56 +00:00
|
|
|
# Init
|
2022-05-12 19:49:19 +00:00
|
|
|
echo "Compiling init.fnl ..."
|
2022-04-05 21:13:56 +00:00
|
|
|
$fennel "$config_store_path/init.fnl" > "$out/lua/configuration/init.lua"
|
|
|
|
|
|
|
|
# Utils
|
|
|
|
nifoc_store_path="$config_store_path/nifoc"
|
|
|
|
nifoc_store_fnl="$(find "$nifoc_store_path" -type f -name '*.fnl')"
|
|
|
|
|
|
|
|
for fnlfile in $nifoc_store_fnl; do
|
|
|
|
file_out_path="$(echo "$fnlfile" | sed "s|$nifoc_store_path/||" | sed "s/.fnl$/.lua/")"
|
|
|
|
|
|
|
|
echo "Compiling $fnlfile ..."
|
|
|
|
$fennel "$fnlfile" > "$out/lua/nifoc/$file_out_path"
|
|
|
|
done
|
|
|
|
|
|
|
|
# After
|
|
|
|
after_store_path="$config_store_path/after"
|
|
|
|
after_store_fnl="$(find "$after_store_path" -type f -name '*.fnl')"
|
2022-04-05 19:57:44 +00:00
|
|
|
|
2022-04-05 21:13:56 +00:00
|
|
|
for fnlfile in $after_store_fnl; do
|
|
|
|
file_out_path="$(echo "$fnlfile" | sed "s|$after_store_path/||" | sed "s/.fnl$/.lua/")"
|
2022-04-05 19:57:44 +00:00
|
|
|
|
|
|
|
echo "Compiling $fnlfile ..."
|
2022-04-05 21:13:56 +00:00
|
|
|
$fennel "$fnlfile" > "$out/after/$file_out_path"
|
2022-04-05 19:57:44 +00:00
|
|
|
done
|
|
|
|
|
2022-05-12 19:49:19 +00:00
|
|
|
# Plugins
|
|
|
|
echo "Compiling plugin configuration ..."
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
${config.programs.neovim.generatedConfigs.fennel}
|
|
|
|
nil
|
|
|
|
EOF
|
|
|
|
} | $fennel - > "$out/lua/configuration/plugins.lua"
|
|
|
|
|
|
|
|
# Other
|
|
|
|
echo "Copying tree-sitter queries ..."
|
2022-04-05 21:13:56 +00:00
|
|
|
cp -r "$after_store_path/queries" "$out/after/"
|
2022-04-05 19:57:44 +00:00
|
|
|
|
2022-04-05 21:13:56 +00:00
|
|
|
stylua "$out/"
|
|
|
|
'';
|
2021-12-06 22:35:29 +00:00
|
|
|
recursive = true;
|
|
|
|
};
|
2021-12-27 20:24:11 +00:00
|
|
|
|
2022-07-06 21:44:31 +00:00
|
|
|
home = {
|
2022-08-11 19:00:49 +00:00
|
|
|
activation.neovimActivation = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
|
|
|
echo -n 'Removing luacache files: '
|
|
|
|
$DRY_RUN_CMD rm -f $HOME/.cache/nvim/luacache*
|
|
|
|
echo 'Done'
|
|
|
|
'';
|
2022-07-06 21:44:31 +00:00
|
|
|
|
|
|
|
sessionVariables.EDITOR = "nvim";
|
|
|
|
|
|
|
|
file = {
|
|
|
|
"${nvim-spell-directory}/de.utf-8.spl".source = builtins.fetchurl {
|
|
|
|
url = "http://ftp.vim.org/pub/vim/runtime/spell/de.utf-8.spl";
|
|
|
|
sha256 = "73c7107ea339856cdbe921deb92a45939c4de6eb9c07261da1b9dd19f683a3d1";
|
|
|
|
};
|
|
|
|
|
|
|
|
"${nvim-spell-directory}/de.utf-8.sug".source = builtins.fetchurl {
|
|
|
|
url = "http://ftp.vim.org/pub/vim/runtime/spell/de.utf-8.sug";
|
|
|
|
sha256 = "13d0ecf92863d89ef60cd4a8a5eb2a5a13a0e8f9ba8d1c6abe47aba85714a948";
|
|
|
|
};
|
|
|
|
};
|
2022-04-01 23:17:03 +00:00
|
|
|
};
|
2021-12-06 22:35:29 +00:00
|
|
|
}
|