This repository has been archived on 2025-01-07. You can view files and clone it, but cannot push or open issues or pull requests.
opdavies.nvim/lib/default.nix
Oliver Davies 472c36a437 Refactor adding Vim plugins
Remove the `vimPlugin.` prefix as much as possible.
2024-09-03 23:38:54 +01:00

278 lines
5.4 KiB
Nix

{ inputs, self }:
let
inherit (inputs.nixpkgs) legacyPackages;
in
rec {
mkVimPlugin =
{ system }:
let
inherit (pkgs) vimUtils;
inherit (vimUtils) buildVimPlugin;
pkgs = legacyPackages.${system};
in
buildVimPlugin {
name = "opdavies";
postInstall = ''
rm -rf $out/.envrc
rm -rf $out/.gitignore
rm -rf $out/.luacheckrc
rm -rf $out/.markdownlint.yaml
rm -rf $out/CHANGELOG.md
rm -rf $out/flake.lock
rm -rf $out/flake.nix
rm -rf $out/lib
rm -rf $out/overlays
rm -rf $out/run
rm -rf $out/stylua.toml
rm -rf $out/todo
'';
src = ../.;
};
mkNeovimPlugins =
{ system }:
let
pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ (import "${self}/overlays/vim-plugins.nix") ];
};
pkgs2305 = inputs.nixpkgs-2305.legacyPackages.${system};
opdavies-nvim = mkVimPlugin { inherit system; };
in
with pkgs.vimPlugins;
[
comment-nvim
conf-vim
dial-nvim
edit-alternate-vim
fidget-nvim
gitsigns-nvim
harpoon
impatient-nvim
inputs.nixpkgs-2305.legacyPackages.${system}.rest-nvim
mini-nvim
neodev-nvim
nvim-spectre
nvim-web-devicons
oil-nvim
refactoring-nvim
standard-vim
tabline-vim
treesj
undotree
vim-abolish
vim-autoread
vim-eunuch
vim-highlightedyank
vim-just
vim-nix
vim-obsession
vim-pasta
vim-repeat
vim-sleuth
vim-terraform
vim-textobj-user
vim-textobj-xmlattr
vim-tmux-navigator
vim-unimpaired
vim-zoom
# Testing
vim-test
# Git
committia-vim
diffview-nvim
vim-fugitive
# Debugging
nvim-dap
nvim-dap-ui
nvim-dap-virtual-text
# Treesitter
(pkgs.vimPlugins.nvim-treesitter.withPlugins (
plugins: with plugins; [
bash
comment
css
csv
dockerfile
gitattributes
gitignore
go
html
javascript
json
kdl
lua
luadoc
make
markdown
markdown_inline
nix
php
phpdoc
query
rst
scss
sql
terraform
tmux
twig
typescript
vim
vimdoc
vue
xml
yaml
]
))
nvim-treesitter-context
nvim-treesitter-textobjects
# LSP, linting and formatting
conform-nvim
lsp-status-nvim
nvim-lint
nvim-lspconfig
# Completion
cmp-buffer
cmp-cmdline
cmp-nvim-lsp
cmp-path
cmp-treesitter
cmp_luasnip
lspkind-nvim
nvim-cmp
pkgs2305.vimPlugins.phpactor
# Snippets
friendly-snippets
luasnip
# Telescope
plenary-nvim
popup-nvim
telescope-frecency-nvim
telescope-fzf-native-nvim
telescope-live-grep-args-nvim
telescope-nvim
telescope-ui-select-nvim
# Databases
vim-dadbod
vim-dadbod-ui
vim-dadbod-completion
# Themes
catppuccin-nvim
# Configuration.
opdavies-nvim
];
mkExtraPackages =
{ system }:
let
inherit (pkgs) nodePackages lua54Packages php82Packages;
pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
};
in
with pkgs;
[
# Languages
nodePackages.typescript
nodejs-slim
php81
# Language servers
gopls
lua-language-server
lua54Packages.luacheck
marksman
nil
nodePackages."@tailwindcss/language-server"
nodePackages.bash-language-server
nodePackages.dockerfile-language-server-nodejs
nodePackages.intelephense
nodePackages.typescript-language-server
nodePackages.vls
nodePackages.volar
nodePackages.vscode-langservers-extracted
nodePackages.vue-language-server
nodePackages.yaml-language-server
phpactor
terraform-ls
# Formatters
black
eslint_d
nixfmt-rfc-style
nodePackages.prettier
stylua
yamlfmt
# Tools
hadolint
html-tidy
nodePackages.jsonlint
nodePackages.markdownlint-cli
php82Packages.php-codesniffer
php82Packages.phpstan
proselint
shellcheck
yamllint
];
mkExtraConfig = ''
lua << EOF
require 'opdavies'
EOF
'';
mkNeovim =
{ system }:
let
inherit (pkgs) lib neovim;
extraPackages = mkExtraPackages { inherit system; };
pkgs = legacyPackages.${system};
start = mkNeovimPlugins { inherit system; };
in
neovim.override {
configure = {
customRC = mkExtraConfig;
packages.main = {
inherit start;
};
};
extraMakeWrapperArgs = ''--suffix PATH : "${lib.makeBinPath extraPackages}"'';
};
mkHomeManager =
{ system }:
let
extraConfig = mkExtraConfig;
extraPackages = mkExtraPackages { inherit system; };
plugins = mkNeovimPlugins { inherit system; };
in
{
inherit extraConfig extraPackages plugins;
enable = true;
};
}