marleyvim/flake.nix
2025-03-16 16:35:28 -07:00

466 lines
10 KiB
Nix

# Copyright (c) 2023 BirdeeHub
# Licensed under the MIT license
{
description = "A Lua-natic's neovim flake, with extra cats! nixCats!";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nixCats.url = "github:BirdeeHub/nixCats-nvim";
devenv.url = "github:cachix/devenv";
marleyos.url = "git+https://codewith.babesonthe.net/punkfairie/marleyos";
neovim-nightly-overlay = {
url = "github:nix-community/neovim-nightly-overlay";
};
plugins-nvim-emmet = {
url = "github:olrtg/nvim-emmet";
flake = false;
};
"plugins-cutlass.nvim" = {
url = "github:gbprod/cutlass.nvim";
flake = false;
};
"plugins-nerdy.nvim" = {
url = "github:2kabhishek/nerdy.nvim";
flake = false;
};
};
nixConfig = {
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
extra-substituters = "https://devenv.cachix.org";
};
outputs = {
self,
nixpkgs,
nixCats,
devenv,
...
} @ inputs: let
inherit (nixCats) utils;
luaPath = "${./.}";
forEachSystem = utils.eachSystem nixpkgs.lib.platforms.all;
# import nixpkgs { config = extra_pkg_config; inherit system; }
extra_pkg_config = {
# allowUnfree = true;
};
dependencyOverlays = [
(utils.sanitizedPluginOverlay inputs)
];
categoryDefinitions = {
pkgs,
# settings,
# categories,
# extra,
name,
# mkNvimPlugin,
...
}: {
lspsAndRuntimeDeps = with pkgs; let
npm-modules = (import ./packages/npm-modules) {
inherit pkgs;
nodejs = pkgs.nodejs_20;
};
in {
general = [
(callPackage ./packages/erb-lint {})
alejandra
bash-language-server
biome
codespell
curl
deadnix
djlint
docker-compose-language-service
dockerfile-language-server-nodejs
dotenv-linter
editorconfig-checker
emmet-language-server
fd
fish-lsp
gofumpt
gopls
gotools
grpcurl
hadolint
helm-ls
htmlhint
jq
lazygit
lua-language-server
markdownlint-cli2
marksman
nil
nodePackages.alex
nodePackages.prettier
npm-modules.css-variables-language-server
npm-modules.gh-actions-language-server
npm-modules.markdown-toc
npm-modules.some-sass-language-server
nushell
php84Packages.php-codesniffer
php84Packages.php-cs-fixer
phpactor
pyright
ripgrep
rubocop
ruby-lsp
rubyPackages.erb-formatter
ruff
shellcheck
shfmt
sqlfluff
statix
stdenv.cc.cc
stylelint
stylelint-lsp
stylua
tailwindcss-language-server
taplo
terraform-ls
tflint
universal-ctags
vscode-langservers-extracted
vtsls
vue-language-server
yaml-language-server
yamllint
zizmor
];
};
startupPlugins = with pkgs.vimPlugins;
with pkgs.neovimPlugins; {
general = [
# LazyVim
lazy-nvim
LazyVim
# Coding
{
plugin = mini-pairs;
name = "mini.pairs";
}
ts-comments-nvim
{
plugin = mini-ai;
name = "mini.ai";
}
lazydev-nvim
# Colorscheme
tokyonight-nvim
{
plugin = catppuccin-nvim;
name = "catppuccin";
}
# Editor
grug-far-nvim
flash-nvim
which-key-nvim
gitsigns-nvim
trouble-nvim
todo-comments-nvim
# Formatting
conform-nvim
# Linting
nvim-lint
# LSP
nvim-lspconfig
# Treesitter
nvim-treesitter.withAllGrammars
nvim-treesitter-textobjects
nvim-ts-autotag
# UI
bufferline-nvim
lualine-nvim
noice-nvim
{
plugin = mini-icons;
name = "mini.icons";
}
nui-nvim
# Util
snacks-nvim
persistence-nvim
plenary-nvim
# Extras
# Coding
# Blink
blink-cmp
friendly-snippets
# Luasnip
{
plugin = luasnip;
name = "LuaSnip";
}
# Mini-comment
{
plugin = mini-comment;
name = "mini.comment";
}
nvim-ts-context-commentstring
# Mini-surround
{
plugin = mini-surround;
name = "mini.surround";
}
# Neogen
neogen
# yanky.nvim
yanky-nvim
# Editor
# Aerial
aerial-nvim
# Dial
dial-nvim
# Navic
nvim-navic
# Neo-tree
neo-tree-nvim
# Refactoring
refactoring-nvim
# Lang
# Go
nvim-dap-go
neotest-golang
# Helm
vim-helm
# JSON & YAML
SchemaStore-nvim
# Markdown
markdown-preview-nvim
render-markdown-nvim
# Python
neotest-python
# Ruby
neotest-rspec
# Sql
vim-dadbod
vim-dadbod-completion
vim-dadbod-ui
# Test
# Neotest
neotest
nvim-nio
# UI
# edgy.nvim
edgy-nvim
# Mini Animate
{
plugin = mini-animate;
name = "mini.animate";
}
# Treesitter-context
nvim-treesitter-context
# Util
# Mini Hipatterns
{
plugin = mini-hipatterns;
name = "mini.hipatterns";
}
# Octo
octo-nvim
# Project
project-nvim
# Rest
kulala-nvim
# Custom
cutlass-nvim
diffview-nvim
nerdy-nvim
nvim-emmet
rose-pine
treesj
vim-caddyfile
];
};
optionalPlugins = {};
# shared libraries to be added to LD_LIBRARY_PATH variable available to
# nvim runtime
sharedLibraries = {
# general = with pkgs; [
# libgit2
# ];
};
environmentVariables = {
# test = {
# CATTESTVAR = "It worked!";
# };
};
extraWrapperArgs = {
# test = [
# ''--set CATTESTVAR2 "It worked again!"''
# ];
};
extraPython3Packages = {
test = [(_: [])];
};
# populates $LUA_PATH and $LUA_CPATH
extraLuaPackages = {
test = [(_: [])];
};
};
packageDefinitions = {
nvim = {
pkgs,
# mkNvimPlugin,
...
}: {
settings = {
wrapRc = true;
# aliases = [ "vim" ];
neovim-unwrapped = inputs.neovim-nightly-overlay.packages.${pkgs.system}.neovim;
};
categories = {
general = true;
test = false;
};
extra = {
vue-ls-path = "${pkgs.lib.getExe pkgs.vue-language-server}";
};
};
};
defaultPackageName = "nvim";
in
forEachSystem (system: let
# the builder function that makes it all work
nixCatsBuilder =
utils.baseBuilder luaPath {
inherit nixpkgs system dependencyOverlays extra_pkg_config;
}
categoryDefinitions
packageDefinitions;
defaultPackage = nixCatsBuilder defaultPackageName;
pkgs = import nixpkgs {inherit system;};
in {
packages =
(utils.mkAllWithDefault defaultPackage)
// {
devenv-up = self.devShells.${system}.default.config.procfileScript;
devenv-test = self.devShells.${system}.default.config.test;
};
devShells.default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
(
# {
# pkgs,
# config,
# ...
# }:
_: {
packages = [
defaultPackage
];
pre-commit.hooks = {
alejandra.enable = true;
deadnix.enable = true;
statix.enable = true;
stylua.enable = true;
end-of-file-fixer.enable = true;
trim-trailing-whitespace.enable = true;
no-commit-to-branch.enable = true;
};
}
)
];
};
})
// (let
# We also export a nixos module to allow reconfiguration from
# configuration.nix.
nixosModule = utils.mkNixosModules {
moduleNamespace = [defaultPackageName];
inherit
defaultPackageName
dependencyOverlays
luaPath
categoryDefinitions
packageDefinitions
extra_pkg_config
nixpkgs
;
};
# And the same for home manager.
homeModule = utils.mkHomeModules {
moduleNamespace = [defaultPackageName];
inherit
defaultPackageName
dependencyOverlays
luaPath
categoryDefinitions
packageDefinitions
extra_pkg_config
nixpkgs
;
};
in {
overlays =
utils.makeOverlays luaPath {
inherit nixpkgs dependencyOverlays extra_pkg_config;
}
categoryDefinitions
packageDefinitions
defaultPackageName;
nixosModules.default = nixosModule;
homeModules.default = homeModule;
inherit utils nixosModule homeModule;
inherit (utils) templates;
});
}