dotfiles/nix/cgnix/nvim-plugins.nix

108 lines
3.4 KiB
Nix
Raw Normal View History

2024-04-22 12:13:08 +02:00
{ config, pkgs, lib, stdenvNoCC, ... }:
2024-04-14 16:09:11 +02:00
let
plugin = name: fetchGit { url = "https://git.mzte.de/nvim-plugins/${name}.git"; };
plugins = {
# LSP
2024-04-14 18:33:55 +02:00
"20-lspconfig" = plugin "nvim-lspconfig";
"20-nullls" = plugin "null-ls.nvim";
"20-jdtls" = plugin "nvim-jdtls";
2024-04-28 21:58:28 +02:00
"20-lsp-saga" = plugin "lspsaga.nvim";
2024-04-14 16:09:11 +02:00
# CMP
2024-04-14 18:33:55 +02:00
"45-cmp" = plugin "nvim-cmp";
"50-cmp-nvim-lsp" = plugin "cmp-nvim-lsp";
"50-cmp-buffer" = plugin "cmp-buffer";
"50-cmp-path" = plugin "cmp-path";
"50-cmp-cmdline" = plugin "cmp-cmdline";
"50-cmp-luasnip" = plugin "cmp_luasnip";
"50-friendly-snippets" = plugin "friendly-snippets";
"50-luasnip" = plugin "LuaSnip";
"50-cmp-treesitter" = plugin "cmp-treesitter";
2024-04-14 16:09:11 +02:00
# Treesitter
2024-04-14 18:33:55 +02:00
"30-treesitter" = plugin "nvim-treesitter";
"30-autopairs" = plugin "nvim-autopairs";
"30-ts-autotag" = plugin "nvim-ts-autotag";
"30-ts-context" = plugin "nvim-treesitter-context";
"30-tsn-actions" = plugin "ts-node-action";
"30-ts-playground" = plugin "playground";
2024-04-14 16:09:11 +02:00
# Language Support
2024-04-14 18:33:55 +02:00
"30-fish" = plugin "vim-fish";
"30-wgsl" = plugin "wgsl.vim";
"30-nu" = plugin "nvim-nu";
"30-crafttweaker" = plugin "crafttweaker-vim-highlighting";
"30-vaxe" = plugin "vaxe";
2024-07-16 22:59:56 +02:00
"30-nix-update" = plugin "nix-update.nvim";
2024-04-14 16:09:11 +02:00
# Misc
2024-04-14 18:33:55 +02:00
"50-catppuccin" = plugin "catppuccin";
"50-gitsigns" = plugin "gitsigns.nvim";
"50-lualine" = plugin "lualine.nvim";
"50-tree" = plugin "nvim-tree.lua";
"50-neogit" = fetchGit { url = "https://git.mzte.de/nvim-plugins/neogit.git?rev=nightly"; };
"50-telescope" = plugin "telescope.nvim";
"50-toggleterm" = plugin "toggleterm.nvim";
2024-04-26 16:06:58 +02:00
"50-dressing" = plugin "dressing.nvim";
2024-04-14 18:33:55 +02:00
"50-ufo" = plugin "nvim-ufo";
"50-dap" = plugin "nvim-dap";
"50-dapui" = plugin "nvim-dap-ui";
"50-harpoon" = plugin "harpoon";
"50-recorder" = plugin "nvim-recorder";
2024-04-26 16:06:58 +02:00
"50-lsp-progress" = plugin "lsp-progress.nvim";
2024-04-14 16:09:11 +02:00
# Libraries
2024-04-14 18:33:55 +02:00
"10-plenary" = plugin "plenary.nvim";
"10-devicons" = plugin "nvim-web-devicons";
"10-promise-async" = plugin "promise-async";
"10-nio" = plugin "nvim-nio";
"10-nui" = plugin "nui.nvim";
2024-04-14 16:09:11 +02:00
};
mzte-nv-compiler =
let
path = "${builtins.getEnv "HOME"}/.local/bin/mzte-nv-compile";
in
if (builtins.pathExists path) then
# This derivation exists to patch a potentially mismatched dynamic linker.
2024-04-22 12:13:08 +02:00
stdenvNoCC.mkDerivation
2024-04-14 16:09:11 +02:00
{
name = "mzte-nv-compiler-patched";
nativeBuildInputs = [ pkgs.autoPatchelfHook ];
buildInputs = with pkgs; [ luajit ];
dontUnpack = true;
buildPhase = ''
cp ${/. + path} $out
'';
} else "";
in
{
options.cgnix.nvim-plugins = lib.mkOption { };
config.cgnix.nvim-plugins = plugins;
2024-04-22 12:13:08 +02:00
config.cgnix.entries.nvim_plugins = stdenvNoCC.mkDerivation {
name = "nvim-plugins";
2024-04-14 16:09:11 +02:00
2024-04-22 12:13:08 +02:00
nativeBuildInputs = with pkgs; [ luajit luajitPackages.fennel ];
2024-04-14 16:09:11 +02:00
2024-04-22 12:13:08 +02:00
unpackPhase = ''
# Copy plugins sources here
mkdir plugins
2024-04-22 12:13:08 +02:00
${builtins.concatStringsSep "\n" (lib.mapAttrsToList
(name: src: "cp -r ${src} plugins/${name}")
2024-04-22 12:13:08 +02:00
config.cgnix.nvim-plugins)}
chmod -R +rw plugins
2024-04-22 12:13:08 +02:00
'';
2024-04-14 16:09:11 +02:00
2024-04-22 12:13:08 +02:00
buildPhase = ''
# Compile
${if mzte-nv-compiler != "" then "${mzte-nv-compiler} plugins" else ""}
2024-04-22 12:13:08 +02:00
'';
installPhase = ''
mv plugins "$out"
2024-04-22 12:13:08 +02:00
'';
};
2024-04-14 16:09:11 +02:00
}