use nixneovim for neovim management

This commit is contained in:
Adithya 2023-05-27 17:07:47 +05:30
parent 40fc938ac4
commit 649825e97b
Signed by: adtya
GPG key ID: 48FC9915FFD326D0
5 changed files with 246 additions and 375 deletions

View file

@ -1,28 +1,5 @@
{ {
"nodes": { "nodes": {
"beautysh": {
"inputs": {
"nixpkgs": [
"nixvim",
"nixpkgs"
],
"poetry2nix": "poetry2nix",
"utils": "utils"
},
"locked": {
"lastModified": 1680308980,
"narHash": "sha256-aUEHV0jk2qIFP3jlsWYWhBbm+w/N9gzH3e4I5DcdB5s=",
"owner": "lovesegfault",
"repo": "beautysh",
"rev": "9845efc3ea3e86cc0d41465d720a47f521b2799c",
"type": "github"
},
"original": {
"owner": "lovesegfault",
"repo": "beautysh",
"type": "github"
}
},
"crane": { "crane": {
"inputs": { "inputs": {
"flake-compat": [ "flake-compat": [
@ -75,11 +52,11 @@
"flake-compat_2": { "flake-compat_2": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1673956053, "lastModified": 1650374568,
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -128,30 +105,12 @@
} }
}, },
"flake-utils_2": { "flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": { "locked": {
"lastModified": 1681202837, "lastModified": 1656928814,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401", "rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_3": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -182,28 +141,6 @@
"type": "github" "type": "github"
} }
}, },
"gitignore_2": {
"inputs": {
"nixpkgs": [
"nixvim",
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1660459072,
"narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "a20de23b925fd8264fd7fad6454652e142fd7f73",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -211,11 +148,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1684321175, "lastModified": 1685171645,
"narHash": "sha256-V4EbM+jK7pvjKBaj0dgAiW9ultzDE27Nz5fRyu/ceMk=", "narHash": "sha256-CpJfOjvsbxQzevKiV8jWK/c+j/eW61HgvCrImeFeCpY=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "59659243cd4ababda605e79b4a9c2e6d83e24c86", "rev": "6a1922568337e7cf21175213d3aafd1ac79c9a2e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -252,11 +189,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1684327479, "lastModified": 1685182442,
"narHash": "sha256-MqFzPr5DwHlK4lcobLfniRtwMdEatPclNtjGOhuVnzE=", "narHash": "sha256-gPcAwOAoxYpP5An0V3HTI2JnAb2wb1u90IT2FbAG6SQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "lanzaboote", "repo": "lanzaboote",
"rev": "d93eebb9c6b377870684c00e012373e84a100d77", "rev": "f641dcfc8b34729d241c95cc7e1c03b21b5b241b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -265,18 +202,80 @@
"type": "github" "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": 1685182616,
"narHash": "sha256-hhVjoqP6dpE4pb6SakYpV1zSlqs+6YILWFqsTdn4jdk=",
"owner": "adtya",
"repo": "nixneovim",
"rev": "194430f95b20ef03a8a23e74b48941427da93052",
"type": "github"
},
"original": {
"owner": "adtya",
"repo": "nixneovim",
"type": "github"
}
},
"nixneovimplugins": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1685024299,
"narHash": "sha256-wxxxz9KarfaCwtz7emLPofIAIyH6ztv1+0P+UiLBKhE=",
"owner": "nixneovim",
"repo": "nixneovimplugins",
"rev": "d2583dd5bf808b11c7593908f5b4ca90fad20bf7",
"type": "github"
},
"original": {
"owner": "nixneovim",
"repo": "nixneovimplugins",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1684305980, "lastModified": 1659190188,
"narHash": "sha256-vd4SKXX1KZfSX6n3eoguJw/vQ+sBL8XGdgfxjEgLpKc=", "narHash": "sha256-LudYrDFPFaQMW0l68TYkPWRPKmqpxIFU1nWfylIp9AQ=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e6e389917a8c778be636e67a67ec958f511cc55d", "rev": "a3fddd46a7f3418d7e3940ded94701aba569161d",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-unstable", "ref": "nixpkgs-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -297,94 +296,51 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-stable_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1678872516, "lastModified": 1684935479,
"narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", "narHash": "sha256-6QMMsXMr2nhmOPHdti2j3KRHt+bai2zw+LJfdCl97Mk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", "rev": "f91ee3065de91a3531329a674a45ddcb3467a650",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-22.11", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
}, },
"nixvim": { "nmd": {
"inputs": { "flake": false,
"beautysh": "beautysh",
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
],
"pre-commit-hooks": "pre-commit-hooks"
},
"locked": { "locked": {
"lastModified": 1684141492, "lastModified": 1680213367,
"narHash": "sha256-j2fWY7kbOETSNDtlX7whkq2APe44PijzgaCTWV8oE/I=", "narHash": "sha256-NbSXxpFAK5IMcsQTK0vSGy099HExx3SEagqW4Lpc+X8=",
"owner": "pta2002", "owner": "rycee",
"repo": "nixvim", "repo": "nmd",
"rev": "3600698abad00756947eb3a3d837beedf1c2f551", "rev": "abb15317ebd17e5a0a7dd105e2ce52f2700185a8",
"type": "github" "type": "gitlab"
}, },
"original": { "original": {
"owner": "pta2002", "owner": "rycee",
"repo": "nixvim", "repo": "nmd",
"type": "github" "type": "gitlab"
} }
}, },
"poetry2nix": { "nmt": {
"inputs": { "flake": false,
"flake-utils": [
"nixvim",
"beautysh",
"utils"
],
"nixpkgs": [
"nixvim",
"beautysh",
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1658665240, "lastModified": 1683843030,
"narHash": "sha256-/wkx7D7enyBPRjIkK0w7QxLQhzEkb3UxNQnjyc3FTUI=", "narHash": "sha256-2K9tFpypgSORyUTRAL7MFRKCXU4GykmhIDrrIydtPdI=",
"owner": "nix-community", "owner": "jooooscha",
"repo": "poetry2nix", "repo": "nmt",
"rev": "8b8edc85d24661d5a6d0d71d6a7011f3e699780f", "rev": "f30b96093eb056f1bcc60199545344b4e4a72c5a",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "jooooscha",
"repo": "poetry2nix", "repo": "nmt",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils_3",
"gitignore": "gitignore_2",
"nixpkgs": [
"nixvim",
"nixpkgs"
],
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1682596858,
"narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "fb58866e20af98779017134319b5663b8215d912",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"type": "github" "type": "github"
} }
}, },
@ -424,8 +380,8 @@
"home-manager": "home-manager", "home-manager": "home-manager",
"impermanence": "impermanence", "impermanence": "impermanence",
"lanzaboote": "lanzaboote", "lanzaboote": "lanzaboote",
"nixpkgs": "nixpkgs", "nixneovim": "nixneovim",
"nixvim": "nixvim" "nixpkgs": "nixpkgs_2"
} }
}, },
"rust-overlay": { "rust-overlay": {
@ -467,36 +423,6 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"locked": {
"lastModified": 1678901627,
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -20,9 +20,10 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nixvim = { nixneovim = {
url = "github:pta2002/nixvim"; url = "github:adtya/nixneovim";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
}; };
}; };
@ -32,7 +33,7 @@
home-manager, home-manager,
impermanence, impermanence,
lanzaboote, lanzaboote,
nixvim, nixneovim,
} @ inputs: { } @ inputs: {
formatter."x86_64-linux" = nixpkgs.legacyPackages."x86_64-linux".alejandra; formatter."x86_64-linux" = nixpkgs.legacyPackages."x86_64-linux".alejandra;
nixosConfigurations = let nixosConfigurations = let
@ -43,7 +44,7 @@
specialArgs = inputs; specialArgs = inputs;
modules = [ modules = [
{ {
nixpkgs.overlays = [(import ./packages)]; nixpkgs.overlays = [(import ./packages) nixneovim.overlays.default];
nixpkgs.hostPlatform = nixpkgs.lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = nixpkgs.lib.mkDefault "x86_64-linux";
system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev; system.configurationRevision = nixpkgs.lib.mkIf (self ? rev) self.rev;
} }
@ -62,7 +63,7 @@
users.${user.primary.userName} = {pkgs, ...}: { users.${user.primary.userName} = {pkgs, ...}: {
imports = [ imports = [
impermanence.nixosModules.home-manager.impermanence impermanence.nixosModules.home-manager.impermanence
nixvim.homeManagerModules.nixvim nixneovim.nixosModules.default
./home/common ./home/common
./home/desktop ./home/desktop
]; ];

View file

@ -7,7 +7,7 @@
./gnupg.nix ./gnupg.nix
./kitty.nix ./kitty.nix
./mpv.nix ./mpv.nix
./nixvim.nix ./neovim.nix
./tmux.nix ./tmux.nix
./virt-manager.nix ./virt-manager.nix
./yt-dlp.nix ./yt-dlp.nix

View file

@ -0,0 +1,134 @@
{
pkgs,
...
}: {
programs.nixneovim = {
enable = true;
extraLuaPreConfig = ''
vim.g.gitblame_date_format = '%r'
vim.g.gitblame_message_when_not_committed = '''
vim.opt.list = true
vim.opt.listchars:append "space:"
vim.opt.listchars:append "eol:"
'';
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;
}
];
};
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;
};
};
};
};
}

View file

@ -1,190 +0,0 @@
{
config,
pkgs,
...
}: {
programs.nixvim = {
enable = true;
vimAlias = true;
viAlias = true;
extraConfigLuaPre = ''
vim.g.gitblame_date_format = '%r'
vim.g.gitblame_message_when_not_committed = '''
vim.opt.list = true
vim.opt.listchars:append "space:"
vim.opt.listchars:append "eol:"
'';
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;
};
maps = {
normal = {
"<C-a>" = ":bp<Return>";
"<C-d>" = ":bn<Return>";
"<C-h>" = {
silent = true;
action = ":noh<Return>";
};
"<leader>w" = {
silent = true;
action = ":bdelete<Return>:bnext<Return>";
};
"<leader>1" = {
silent = true;
action = ":NvimTreeToggle<Return>";
};
"<leader>`" = {
silent = true;
action = ":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>";
};
};
};
extraPlugins = with pkgs.vimPlugins; [dracula-nvim git-blame-nvim];
colorscheme = "dracula";
plugins = {
comment-nvim.enable = true;
fugitive.enable = true;
gitsigns.enable = true;
trouble.enable = true;
nvim-cmp = {
enable = true;
snippet.expand = "luasnip";
sources = [
{name = "buffer";}
{name = "nvim_lsp";}
{name = "nvim_lsp_document_symbol";}
{name = "nvim_lsp_signature_help";}
{name = "treesitter";}
{name = "luasnip";}
];
};
cmp-buffer.enable = true;
cmp-nvim-lsp.enable = true;
cmp-nvim-lsp-document-symbol.enable = true;
cmp-nvim-lsp-signature-help.enable = true;
cmp-treesitter.enable = true;
cmp_luasnip.enable = true;
luasnip.enable = true;
bufferline = {
enable = true;
diagnostics = "nvim_lsp";
offsets = [
{
filetype = "NvimTree";
separator = true;
}
];
separatorStyle = "slant";
truncateNames = true;
};
treesitter = {
enable = true;
grammarPackages = with config.programs.nixvim.plugins.treesitter.package.builtGrammars; [
bash
dockerfile
gitcommit
gitignore
git_rebase
go
markdown
markdown_inline
nix
rust
toml
yaml
];
indent = true;
incrementalSelection.enable = true;
};
treesitter-context = {
enable = true;
};
treesitter-refactor = {
enable = true;
};
telescope = {
enable = true;
extensions = {
fzy-native = {
enable = true;
};
};
};
lualine = {
enable = true;
globalstatus = true;
};
indent-blankline = {
enable = true;
showEndOfLine = true;
};
nvim-tree = {
enable = true;
disableNetrw = true;
filesystemWatchers.enable = true;
};
null-ls = {
enable = true;
sources = {
code_actions = {
shellcheck.enable = true;
};
diagnostics = {
shellcheck.enable = true;
};
formatting = {
alejandra.enable = true;
};
};
};
lsp = {
enable = true;
servers = {
gopls = {
enable = true;
filetypes = ["go"];
};
nil_ls = {
enable = true;
filetypes = ["nix"];
};
rust-analyzer = {
enable = true;
filetypes = ["rs"];
};
};
};
};
};
}