This repository has been archived on 2024-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
neovim/flake.nix

298 lines
7.2 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
nix2lua.url = "git+https://git.pleshevski.ru/mynix/nix2lua";
# Plenary (required by crates-nvim)
plenary-nvim = {
url = "github:nvim-lua/plenary.nvim";
flake = false;
};
# config
# https://github.com/gpanders/editorconfig.nvim
editorconfig-nvim = {
url = "github:gpanders/editorconfig.nvim";
flake = false;
};
# explorer
# https://github.com/kyazdani42/nvim-tree.lua
nvim-tree-lua = {
url = "github:kyazdani42/nvim-tree.lua";
flake = false;
};
# https://github.com/nvim-telescope/telescope.nvim
telescope-nvim = {
url = "github:nvim-telescope/telescope.nvim";
flake = false;
};
# https://github.com/nvim-telescope/telescope-live-grep-args.nvim
telescope-live-grep-args-nvim = {
url = "github:nvim-telescope/telescope-live-grep-args.nvim";
flake = false;
};
# formatter
# https://github.com/sbdchd/neoformat
neoformat = {
url = "github:sbdchd/neoformat";
flake = false;
};
# git
# https://github.com/lewis6991/gitsigns.nvim
gitsigns-nvim = {
url = "github:lewis6991/gitsigns.nvim";
flake = false;
};
# lsp
# https://github.com/neovim/nvim-lspconfig
nvim-lspconfig = {
url = "github:neovim/nvim-lspconfig";
flake = false;
};
# https://github.com/tamago324/nlsp-settings.nvim
nlsp-settings-nvim = {
url = "github:tamago324/nlsp-settings.nvim";
flake = false;
};
# https://github.com/glepnir/lspsaga.nvim
lspsaga-nvim = {
url = "github:glepnir/lspsaga.nvim?rev=f33bc99d0ed3ed691a58b3339decf4e1933c3f9e";
flake = false;
};
# https://github.com/L3MON4D3/LuaSnip
luasnip = {
url = "github:L3MON4D3/LuaSnip";
flake = false;
};
# https://github.com/hrsh7th/nvim-cmp
nvim-cmp = {
url = "github:hrsh7th/nvim-cmp";
flake = false;
};
# https://github.com/hrsh7th/cmp-nvim-lsp
cmp-nvim-lsp = {
url = "github:hrsh7th/cmp-nvim-lsp";
flake = false;
};
# https://github.com/saadparwaiz1/cmp_luasnip
cmp-luasnip = {
url = "github:saadparwaiz1/cmp_luasnip";
flake = false;
};
# theme
# https://github.com/nanozuki/tabby.nvim
tabby-nvim = {
url = "github:nanozuki/tabby.nvim";
flake = false;
};
# https://github.com/nvim-lualine/lualine.nvim
lualine-nvim = {
url = "github:nvim-lualine/lualine.nvim";
flake = false;
};
# https://github.com/arkav/lualine-lsp-progress
lualine-lsp-progress = {
url = "github:/arkav/lualine-lsp-progress";
flake = false;
};
# https://github.com/kyazdani42/nvim-web-devicons
nvim-web-devicons = {
url = "github:kyazdani42/nvim-web-devicons";
flake = false;
};
# https://github.com/catppuccin/nvim
catppuccin = {
url = "github:catppuccin/nvim";
flake = false;
};
# ux
# https://github.com/phaazon/hop.nvim
hop-nvim = {
url = "github:phaazon/hop.nvim";
flake = false;
};
# https://github.com/nvim-orgmode/orgmode
nvim-orgmode = {
url = "github:nvim-orgmode/orgmode?rev=fc9bb0f5823d01e4008e4b86663772d4148aa9ce";
flake = false;
};
# https://github.com/akinsho/org-bullets.nvim
org-bullets-nvim = {
url = "github:akinsho/org-bullets.nvim";
flake = false;
};
# https://github.com/norcalli/nvim-colorizer.lua
nvim-colorizer = {
url = "github:norcalli/nvim-colorizer.lua";
flake = false;
};
# https://github.com/nzlov/cmp-tabby
cmp-tabby = {
url = "github:nzlov/cmp-tabby";
flake = false;
};
};
outputs = inputs @ { self, nixpkgs, flake-utils, nix2lua, ... }:
let
inputPlugins = [
"plenary-nvim"
# config
"editorconfig-nvim"
# explorer
"nvim-tree-lua"
"telescope-nvim"
"telescope-live-grep-args-nvim"
# formatter
"neoformat"
# git
"gitsigns-nvim"
# lsp
"nvim-lspconfig"
"nlsp-settings-nvim"
"lspsaga-nvim"
"luasnip"
"nvim-cmp"
"cmp-nvim-lsp"
"cmp-luasnip"
# theme
"tabby-nvim"
"lualine-nvim"
"lualine-lsp-progress"
"nvim-web-devicons"
"catppuccin"
# ux
"hop-nvim"
"nvim-orgmode"
"org-bullets-nvim"
"nvim-colorizer"
"cmp-tabby"
];
mkNvimPlugins = { lib, vimUtils, vimPlugins, ... }:
let
inherit (builtins) getAttr attrNames pathExists readDir;
inherit (lib) listToAttrs nameValuePair;
buildPlugin = name: vimUtils.buildVimPlugin {
name = name;
src = getAttr name inputs;
patches = lib.optionals
(pathExists ./patches/${name})
(map
(patchName: ./patches/${name}/${patchName})
(attrNames (readDir ./patches/${name}))
);
};
buildPluginValuePair = n: nameValuePair n (buildPlugin n);
neovimPlugins = (listToAttrs (map buildPluginValuePair inputPlugins)) // {
inherit (vimPlugins) nvim-treesitter;
};
in
{
inherit neovimPlugins;
inherit nix2lua;
};
mkNeovim = pkgs: pkgs.callPackage ./neovim.nix (mkNvimPlugins pkgs);
in
{
overlays = {
default = final: prev: {
myneovim = mkNeovim prev;
};
};
} //
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
minimalNeovim = mkNeovim pkgs;
allNeovim = minimalNeovim.override (prev: {
modules = {
catppuccin = { };
nvim-tree-lua = {
configs.renderer = {
group_empty = true;
full_name = true;
};
};
nvim-treesitter = { };
gitsigns-nvim = { };
neoformat = { };
hop-nvim = { };
telescope-nvim = { };
};
plugins = with prev.nix2lua.lib; {
lualine-nvim = pipe1
(require "lualine")
(call "setup" {
options.ignore_focus = [ "NvimTree" ];
sections = {
lualine_a = [
[ "filename" (nf "path" 1) ]
];
lualine_b = [ "branch" "diff" "diagnostics" ];
lualine_c = [ "lsp_progress" ];
lualine_x = [ "filesize" "filetype" ];
lualine_y = [ "progress" ];
lualine_z = [ "location" "mode" ];
};
});
nvim-colorizer = pipe1
(require "colorizer")
(call0 "setup");
};
});
packages = {
minimal = minimalNeovim;
all = allNeovim;
};
in
{
inherit packages;
devShells.default = pkgs.mkShell {
packages = [
pkgs.stylua # lua formatter
];
};
});
}