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
Raw Normal View History

2022-09-15 01:22:06 +03:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
2022-11-19 00:56:53 +03:00
flake-utils.url = "github:numtide/flake-utils";
nix2lua.url = "git+https://git.pleshevski.ru/mynix/nix2lua";
2022-09-19 18:44:57 +03:00
2022-09-24 17:21:16 +03:00
# Plenary (required by crates-nvim)
plenary-nvim = {
url = "github:nvim-lua/plenary.nvim";
flake = false;
};
2022-09-24 17:21:16 +03:00
# config
2022-09-19 19:03:40 +03:00
2022-09-24 17:21:16 +03:00
# https://github.com/gpanders/editorconfig.nvim
2022-09-19 19:03:40 +03:00
editorconfig-nvim = {
2023-02-03 02:22:57 +03:00
url = "github:gpanders/editorconfig.nvim";
2022-09-19 19:03:40 +03:00
flake = false;
};
2022-09-24 17:21:16 +03:00
# explorer
# https://github.com/kyazdani42/nvim-tree.lua
nvim-tree-lua = {
2023-02-03 02:22:57 +03:00
url = "github:kyazdani42/nvim-tree.lua";
2022-09-24 17:21:16 +03:00
flake = false;
};
# https://github.com/nvim-telescope/telescope.nvim
telescope-nvim = {
2023-02-03 02:22:57 +03:00
url = "github:nvim-telescope/telescope.nvim";
2022-09-24 17:21:16 +03:00
flake = false;
};
# https://github.com/nvim-telescope/telescope-live-grep-args.nvim
telescope-live-grep-args-nvim = {
2023-02-03 02:22:57 +03:00
url = "github:nvim-telescope/telescope-live-grep-args.nvim";
flake = false;
};
2022-09-19 20:43:20 +03:00
2022-09-24 17:21:16 +03:00
# formatter
# https://github.com/sbdchd/neoformat
neoformat = {
2023-02-03 02:22:57 +03:00
url = "github:sbdchd/neoformat";
2022-09-24 17:21:16 +03:00
flake = false;
};
# git
# https://github.com/lewis6991/gitsigns.nvim
gitsigns-nvim = {
2023-02-03 02:22:57 +03:00
url = "github:lewis6991/gitsigns.nvim";
2022-09-24 17:21:16 +03:00
flake = false;
};
# lsp
# https://github.com/neovim/nvim-lspconfig
nvim-lspconfig = {
2023-02-03 02:22:57 +03:00
url = "github:neovim/nvim-lspconfig";
2022-09-24 17:21:16 +03:00
flake = false;
};
2022-11-10 00:01:34 +03:00
# https://github.com/tamago324/nlsp-settings.nvim
nlsp-settings-nvim = {
2023-02-03 02:22:57 +03:00
url = "github:tamago324/nlsp-settings.nvim";
2022-11-10 00:01:34 +03:00
flake = false;
};
2022-09-24 17:21:16 +03:00
# https://github.com/glepnir/lspsaga.nvim
2022-09-19 20:43:20 +03:00
lspsaga-nvim = {
url = "github:glepnir/lspsaga.nvim?rev=f33bc99d0ed3ed691a58b3339decf4e1933c3f9e";
2022-09-19 20:43:20 +03:00
flake = false;
};
2022-09-24 17:21:16 +03:00
# https://github.com/L3MON4D3/LuaSnip
2022-11-01 11:23:55 +03:00
luasnip = {
2023-02-03 02:22:57 +03:00
url = "github:L3MON4D3/LuaSnip";
2022-09-24 17:21:16 +03:00
flake = false;
};
# https://github.com/hrsh7th/nvim-cmp
nvim-cmp = {
2023-02-03 02:22:57 +03:00
url = "github:hrsh7th/nvim-cmp";
2022-09-24 17:21:16 +03:00
flake = false;
};
# https://github.com/hrsh7th/cmp-nvim-lsp
cmp-nvim-lsp = {
2023-02-03 02:22:57 +03:00
url = "github:hrsh7th/cmp-nvim-lsp";
2022-09-24 17:21:16 +03:00
flake = false;
};
# https://github.com/saadparwaiz1/cmp_luasnip
cmp-luasnip = {
2023-02-03 02:22:57 +03:00
url = "github:saadparwaiz1/cmp_luasnip";
2022-09-24 17:21:16 +03:00
flake = false;
};
# theme
# https://github.com/nanozuki/tabby.nvim
tabby-nvim = {
2023-02-03 02:22:57 +03:00
url = "github:nanozuki/tabby.nvim";
2022-09-24 17:21:16 +03:00
flake = false;
};
# https://github.com/nvim-lualine/lualine.nvim
lualine-nvim = {
2023-02-03 02:22:57 +03:00
url = "github:nvim-lualine/lualine.nvim";
2022-09-24 17:21:16 +03:00
flake = false;
};
# https://github.com/arkav/lualine-lsp-progress
lualine-lsp-progress = {
2023-02-03 02:22:57 +03:00
url = "github:/arkav/lualine-lsp-progress";
2022-09-24 17:21:16 +03:00
flake = false;
};
# https://github.com/kyazdani42/nvim-web-devicons
nvim-web-devicons = {
2023-02-03 02:22:57 +03:00
url = "github:kyazdani42/nvim-web-devicons";
2022-09-24 17:21:16 +03:00
flake = false;
};
# https://github.com/catppuccin/nvim
2024-04-18 00:04:06 +03:00
catppuccin = {
2023-02-03 02:22:57 +03:00
url = "github:catppuccin/nvim";
2022-09-24 17:21:16 +03:00
flake = false;
};
2022-10-22 23:35:27 +03:00
# ux
# https://github.com/phaazon/hop.nvim
hop-nvim = {
2023-02-03 02:22:57 +03:00
url = "github:phaazon/hop.nvim";
2022-10-22 23:35:27 +03:00
flake = false;
};
# https://github.com/nvim-orgmode/orgmode
nvim-orgmode = {
2022-12-01 10:18:47 +03:00
url = "github:nvim-orgmode/orgmode?rev=fc9bb0f5823d01e4008e4b86663772d4148aa9ce";
2022-10-22 23:35:27 +03:00
flake = false;
};
# https://github.com/akinsho/org-bullets.nvim
org-bullets-nvim = {
url = "github:akinsho/org-bullets.nvim";
flake = false;
};
2023-05-22 13:42:35 +03:00
# https://github.com/norcalli/nvim-colorizer.lua
nvim-colorizer = {
url = "github:norcalli/nvim-colorizer.lua";
flake = false;
};
2023-06-09 14:37:25 +03:00
# https://github.com/nzlov/cmp-tabby
cmp-tabby = {
url = "github:nzlov/cmp-tabby";
flake = false;
};
2022-09-15 01:22:06 +03:00
};
2022-11-19 00:56:53 +03:00
outputs = inputs @ { self, nixpkgs, flake-utils, nix2lua, ... }:
2022-09-24 23:46:15 +03:00
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"
2022-11-10 00:01:34 +03:00
"nlsp-settings-nvim"
2022-09-24 23:46:15 +03:00
"lspsaga-nvim"
2022-11-01 11:23:55 +03:00
"luasnip"
2022-09-24 23:46:15 +03:00
"nvim-cmp"
"cmp-nvim-lsp"
"cmp-luasnip"
# theme
"tabby-nvim"
"lualine-nvim"
"lualine-lsp-progress"
"nvim-web-devicons"
2024-04-18 00:04:06 +03:00
"catppuccin"
2022-10-22 23:35:27 +03:00
# ux
"hop-nvim"
"nvim-orgmode"
"org-bullets-nvim"
2023-05-22 13:42:35 +03:00
"nvim-colorizer"
2023-06-09 14:37:25 +03:00
"cmp-tabby"
2022-09-24 23:46:15 +03:00
];
mkNvimPlugins = { lib, vimUtils, vimPlugins, ... }:
let
inherit (builtins) getAttr attrNames pathExists readDir;
2022-09-24 23:46:15 +03:00
inherit (lib) listToAttrs nameValuePair;
buildPlugin = name: vimUtils.buildVimPlugin {
2022-09-24 23:46:15 +03:00
name = name;
src = getAttr name inputs;
2024-04-16 18:54:21 +03:00
patches = lib.optionals
(pathExists ./patches/${name})
(map
2023-05-23 00:19:13 +03:00
(patchName: ./patches/${name}/${patchName})
(attrNames (readDir ./patches/${name}))
);
2022-09-24 23:46:15 +03:00
};
buildPluginValuePair = n: nameValuePair n (buildPlugin n);
2022-11-26 13:25:19 +03:00
neovimPlugins = (listToAttrs (map buildPluginValuePair inputPlugins)) // {
inherit (vimPlugins) nvim-treesitter;
};
2022-09-24 23:46:15 +03:00
in
2022-11-19 19:52:39 +03:00
{
inherit neovimPlugins;
inherit nix2lua;
};
2022-11-30 22:49:32 +03:00
mkNeovim = pkgs: pkgs.callPackage ./neovim.nix (mkNvimPlugins pkgs);
2022-09-24 23:46:15 +03:00
in
{
overlays = {
default = final: prev: {
2022-11-30 22:49:32 +03:00
myneovim = mkNeovim prev;
};
};
} //
2022-11-19 00:56:53 +03:00
flake-utils.lib.eachDefaultSystem (system:
2022-09-15 01:22:06 +03:00
let
2022-09-24 23:46:15 +03:00
pkgs = import nixpkgs { inherit system; };
2022-09-15 01:22:06 +03:00
2022-11-30 22:49:32 +03:00
minimalNeovim = mkNeovim pkgs;
2022-10-22 23:35:27 +03:00
2024-04-20 23:05:33 +03:00
allNeovim = minimalNeovim.override (prev: {
2024-04-17 19:35:34 +03:00
modules = {
2024-04-18 00:04:06 +03:00
catppuccin = { };
2024-04-17 19:35:34 +03:00
nvim-tree-lua = {
2024-04-18 00:04:06 +03:00
configs.renderer = {
group_empty = true;
full_name = true;
2022-11-19 00:56:53 +03:00
};
};
2024-04-18 01:20:31 +03:00
nvim-treesitter = { };
2024-04-21 00:22:39 +03:00
gitsigns-nvim = { };
neoformat = { };
2024-04-21 11:46:13 +03:00
hop-nvim = { };
2022-11-19 00:56:53 +03:00
};
2024-04-17 19:35:34 +03:00
2024-04-18 00:04:06 +03:00
plugins = with prev.nix2lua.lib; {
2024-04-20 23:05:33 +03:00
lualine-nvim = pipe1
2024-04-17 19:35:34 +03:00
(require "lualine")
2024-04-20 23:05:33 +03:00
(call "setup" {
2024-04-17 19:35:34 +03:00
options.ignore_focus = [ "NvimTree" ];
sections = {
lualine_a = [
2024-04-20 23:05:33 +03:00
[ "filename" (nf "path" 1) ]
2024-04-17 19:35:34 +03:00
];
lualine_b = [ "branch" "diff" "diagnostics" ];
lualine_c = [ "lsp_progress" ];
lualine_x = [ "filesize" "filetype" ];
lualine_y = [ "progress" ];
lualine_z = [ "location" "mode" ];
};
2024-04-20 23:05:33 +03:00
});
2024-04-21 11:46:13 +03:00
nvim-colorizer = pipe1
(require "colorizer")
(call0 "setup");
2024-04-17 19:35:34 +03:00
};
2024-04-18 00:04:06 +03:00
});
2022-11-19 16:38:31 +03:00
packages = {
minimal = minimalNeovim;
2024-04-17 19:35:34 +03:00
2024-04-20 23:05:33 +03:00
all = allNeovim;
2022-11-19 16:38:31 +03:00
};
2022-11-19 23:59:09 +03:00
in
{
inherit packages;
2022-09-15 01:22:06 +03:00
devShells.default = pkgs.mkShell {
2022-09-16 23:42:53 +03:00
packages = [
pkgs.stylua # lua formatter
];
2022-09-15 01:22:06 +03:00
};
});
}