use home manager modules for nvim

This commit is contained in:
Adithya 2023-06-04 10:20:19 +05:30
parent f757358f3f
commit feaebcc081
Signed by: adtya
GPG key ID: 48FC9915FFD326D0
3 changed files with 209 additions and 232 deletions

View file

@ -202,60 +202,20 @@
"type": "github"
}
},
"nix-flake-tests": {
"locked": {
"lastModified": 1677844186,
"narHash": "sha256-ErJZ/Gs1rxh561CJeWP5bohA2IcTq1rDneu1WT6CVII=",
"owner": "antifuchs",
"repo": "nix-flake-tests",
"rev": "bbd9216bd0f6495bb961a8eb8392b7ef55c67afb",
"type": "github"
},
"original": {
"owner": "antifuchs",
"repo": "nix-flake-tests",
"type": "github"
}
},
"nixneovim": {
"inputs": {
"home-manager": [
"home-manager"
],
"nix-flake-tests": "nix-flake-tests",
"nixneovimplugins": "nixneovimplugins",
"nixpkgs": [
"nixpkgs"
],
"nmd": "nmd",
"nmt": "nmt"
},
"locked": {
"lastModified": 1685738568,
"narHash": "sha256-79ztyBK2cQPFn8FTQxUf2S6CbbrpzXKqwWSzCtiYspY=",
"owner": "nixneovim",
"repo": "nixneovim",
"rev": "1d01235b5b1bcee85cd26b8f1cec4345d57ca07c",
"type": "github"
},
"original": {
"owner": "nixneovim",
"repo": "nixneovim",
"type": "github"
}
},
"nixneovimplugins": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs"
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1685629088,
"narHash": "sha256-sISQDPrGhUHoiu8aGkMoAn+DjM2LXHUJu5C+1WTxHGw=",
"lastModified": 1685737234,
"narHash": "sha256-pNKT/LB0lS9nufIgMlZB0wQqZzRLr8zs4Ssg2aftSQs=",
"owner": "nixneovim",
"repo": "nixneovimplugins",
"rev": "0536aa939392cd48e6ed95c807b2391c59b54963",
"rev": "4e954a890f9e8bc1481bcf78895ec456b16de827",
"type": "github"
},
"original": {
@ -266,16 +226,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1659190188,
"narHash": "sha256-LudYrDFPFaQMW0l68TYkPWRPKmqpxIFU1nWfylIp9AQ=",
"lastModified": 1685655444,
"narHash": "sha256-6EujQNAeaUkWvpEZZcVF8qSfQrNVWFNNGbUJxv/A5a8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a3fddd46a7f3418d7e3940ded94701aba569161d",
"rev": "e635192892f5abbc2289eaac3a73cdb249abaefd",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -296,54 +256,6 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1685655444,
"narHash": "sha256-6EujQNAeaUkWvpEZZcVF8qSfQrNVWFNNGbUJxv/A5a8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e635192892f5abbc2289eaac3a73cdb249abaefd",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nmd": {
"flake": false,
"locked": {
"lastModified": 1680213367,
"narHash": "sha256-NbSXxpFAK5IMcsQTK0vSGy099HExx3SEagqW4Lpc+X8=",
"owner": "rycee",
"repo": "nmd",
"rev": "abb15317ebd17e5a0a7dd105e2ce52f2700185a8",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmd",
"type": "gitlab"
}
},
"nmt": {
"flake": false,
"locked": {
"lastModified": 1683843030,
"narHash": "sha256-2K9tFpypgSORyUTRAL7MFRKCXU4GykmhIDrrIydtPdI=",
"owner": "jooooscha",
"repo": "nmt",
"rev": "f30b96093eb056f1bcc60199545344b4e4a72c5a",
"type": "github"
},
"original": {
"owner": "jooooscha",
"repo": "nmt",
"type": "github"
}
},
"pre-commit-hooks-nix": {
"inputs": {
"flake-compat": [
@ -380,8 +292,8 @@
"home-manager": "home-manager",
"impermanence": "impermanence",
"lanzaboote": "lanzaboote",
"nixneovim": "nixneovim",
"nixpkgs": "nixpkgs_2"
"nixneovimplugins": "nixneovimplugins",
"nixpkgs": "nixpkgs"
}
},
"rust-overlay": {

View file

@ -20,10 +20,9 @@
inputs.nixpkgs.follows = "nixpkgs";
};
nixneovim = {
url = "github:nixneovim/nixneovim";
nixneovimplugins = {
url = "github:nixneovim/nixneovimplugins";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
};
@ -33,7 +32,7 @@
home-manager,
impermanence,
lanzaboote,
nixneovim,
nixneovimplugins,
} @ inputs: {
formatter."x86_64-linux" = nixpkgs.legacyPackages."x86_64-linux".alejandra;
nixosConfigurations = let
@ -44,7 +43,7 @@
pkgs = import nixpkgs {
inherit system;
config = {allowUnfree = true;};
overlays = [(import ./packages) nixneovim.overlays.default];
overlays = [(import ./packages) nixneovimplugins.overlays.default];
};
specialArgs = inputs;
modules = [
@ -66,7 +65,6 @@
users.${user.primary.userName} = {pkgs, ...}: {
imports = [
impermanence.nixosModules.home-manager.impermanence
nixneovim.nixosModules.default
./home
];
};

View file

@ -1,131 +1,198 @@
{pkgs, ...}: {
programs.nixneovim = {
programs.neovim = {
enable = true;
extraLuaPreConfig = ''
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
withNodeJs = true;
withPython3 = true;
withRuby = true;
defaultEditor = true;
extraPackages = with pkgs; [
fd
ripgrep
tree-sitter
nil
];
plugins = with pkgs.vimExtraPlugins; [
{
plugin = nvim-web-devicons;
type = "lua";
config = ''
require('nvim-web-devicons').setup {
default = true
}
'';
}
{
plugin = dracula-nvim;
type = "lua";
config = ''
require("dracula").setup({
show_end_of_buffer = true,
transparent_bg = true,
italic_comment = true
})
vim.cmd[[colorscheme dracula]]
'';
}
{
plugin = nvim-tree-lua;
type = "lua";
config = ''
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
require('nvim-tree').setup {
diagnostics = {
enable = true
}
}
'';
}
{
plugin = git-blame-nvim;
type = "lua";
config = ''
vim.g.gitblame_date_format = '%r'
vim.g.gitblame_message_when_not_committed = '''
'';
}
{
plugin = gitsigns-nvim;
type = "lua";
config = ''
require('gitsigns').setup()
'';
}
{
plugin = indent-blankline-nvim;
type = "lua";
config = ''
vim.opt.list = true
vim.opt.listchars:append "space:"
vim.opt.listchars:append "eol:"
require("indent_blankline").setup {
show_end_of_line = true
}
'';
extraPlugins = with pkgs.vimExtraPlugins; [dracula-vim git-blame-nvim];
colorscheme = "dracula";
options = {
autowrite = true;
background = "dark";
clipboard = "unnamedplus";
expandtab = true;
laststatus = 2;
list = true;
showmode = false;
swapfile = false;
number = true;
relativenumber = true;
shiftwidth = 2;
signcolumn = "yes";
smartindent = true;
tabstop = 2;
termguicolors = true;
updatetime = 100;
wrap = true;
splitright = true;
splitbelow = true;
};
mappings = {
normal = {
"<C-a>" = "'<cmd>bp<Return>'";
"<C-d>" = "'<cmd>bn<Return>'";
"<C-h>" = {
silent = true;
action = "'<cmd>noh<Return>'";
};
"<leader>w" = {
silent = true;
action = "'<cmd>bdelete<Return><cmd>bnext<Return>'";
};
"<leader>1" = {
silent = true;
action = "'<cmd>NvimTreeToggle<Return>'";
};
"<leader>`" = {
silent = true;
action = "'<cmd>split term://zsh<Return>'";
};
"<leader>ff" = {
silent = true;
action = "'<cmd>Telescope find_files<cr>'";
};
"<leader>fg" = {
silent = true;
action = "'<cmd>Telescope live_grep<cr>'";
};
"<leader>fb" = {
silent = true;
action = "'<cmd>Telescope buffers<cr>'";
};
};
};
plugins = {
comment.enable = true;
fugitive.enable = true;
gitsigns.enable = true;
indent-blankline = {
enable = true;
showEndOfLine = true;
};
telescope.enable = true;
nvim-tree = {
enable = true;
diagnostics.enable = true;
disableNetrw = true;
git.enable = true;
};
bufferline = {
enable = true;
alwaysShowBufferline = true;
diagnostics = "nvim_lsp";
separatorStyle = "slant";
offsets = [
}
{
filetype = "NvimTree";
text = "File Explorer";
separator = true;
plugin = lualine-nvim;
type = "lua";
config = ''
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'dracula-nvim',
globalstatus = true
}
}
'';
}
{
plugin = nvim-lastplace;
type = "lua";
config = ''
require('nvim-lastplace').setup {}
'';
}
{
plugin = toggleterm-nvim;
type = "lua";
config = ''
require('toggleterm').setup{}
'';
}
{
plugin = nvim-treesitter-context;
type = "lua";
config = ''
require('treesitter-context').setup {
enable = true
}
'';
}
{plugin = nvim-treesitter-refactor;}
{
plugin = pkgs.vimPlugins.nvim-treesitter.withPlugins (plugins:
with plugins; [
bash
dockerfile
gitattributes
gitcommit
gitignore
git_config
git_rebase
go
gomod
gosum
ini
json
markdown
markdown_inline
nix
toml
yaml
]);
type = "lua";
config = ''
require('nvim-treesitter.configs').setup {
auto_install = false,
highlight = true,
refactor = {
highlight_definitions = {
enable = true,
clear_on_cursor_move = false
}
}
}
'';
}
{
plugin = nvim-lspconfig;
type = "lua";
config = ''
require('lspconfig').bashls.setup{}
require('lspconfig').dockerls.setup{}
require('lspconfig').docker_compose_language_service.setup{}
require('lspconfig').gopls.setup{}
require('lspconfig').jsonls.setup{}
require('lspconfig').marksman.setup{}
require('lspconfig').nil_ls.setup{}
require('lspconfig').rust_analyzer.setup{}
'';
}
];
};
lualine = {
enable = true;
globalstatus = true;
};
nvim-cmp = {
enable = true;
snippet.luasnip.enable = true;
sources = {
buffer.enable = true;
nvim_lsp.enable = true;
nvim_lsp_document_symbol.enable = true;
nvim_lsp_signature_help.enable = true;
treesitter.enable = true;
luasnip.enable = true;
};
};
luasnip.enable = true;
treesitter = {
enable = true;
installAllGrammars = true;
indent = true;
incrementalSelection.enable = true;
};
treesitter-context.enable = true;
lsp = {
enable = true;
servers = {
gopls.enable = true;
nil.enable = true;
rust-analyzer.enable = true;
};
};
};
extraConfig = ''
set autowrite
set background=dark
set clipboard+=unnamedplus
set expandtab
set laststatus=2
set noshowmode
set noswapfile
set number
set relativenumber
set shiftwidth=2
set signcolumn=yes
set smartindent
set tabstop=2
set termguicolors
set updatetime=100
set wrap
set splitright
set splitbelow
nmap <C-a> <cmd>bp<Return>
nmap <C-d> <cmd>bn<Return>
nnoremap <C-h> <cmd>noh<Return>
nnoremap <leader>w <cmd>bdelete<cmd>bnext<Return>
nnoremap <leader>` <cmd>ToggleTerm<Return>
nnoremap <leader>1 <cmd>NvimTreeToggle<Return>
nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
'';
};
}