chore(flake): restructure the nvim.nix and update flakes

This commit is contained in:
uttarayan21
2024-03-24 20:19:52 +05:30
parent 5b405a5dae
commit b238d71cda
3 changed files with 283 additions and 246 deletions

View File

@@ -36,6 +36,7 @@
cmake cmake
alejandra alejandra
pkg-config pkg-config
devenv
# Misc # Misc
qmk qmk

View File

@@ -22,11 +22,175 @@
}) })
mappings; mappings;
border = ["" "" "" "" "" "" "" ""]; border = ["" "" "" "" "" "" "" ""];
rawLua = lua: {
"__raw" = ''
${lua}
'';
};
in { in {
imports = [inputs.nixvim.homeManagerModules.nixvim]; imports = [inputs.nixvim.homeManagerModules.nixvim];
programs.nixvim = { programs.nixvim = {
enable = true; enable = true;
plugins = { plugins = {
fugitive.enable = true;
oil.enable = true;
surround.enable = true;
todo-comments.enable = true;
trouble.enable = true;
ts-context-commentstring.enable = true;
navic = {
enable = true;
lsp.autoAttach = true;
};
which-key.enable = true;
lualine = {
enable = true;
sections = {
lualine_c = [
{
name =
rawLua
/*
lua
*/
''
function(bufnr)
local opts = { highlight = true }
return require'nvim-navic'.get_location(opts)
end,
cond = function()
return require'nvim-navic'.is_available()
end
'';
}
];
};
};
mini = {
enable = true;
modules = {
ai = {};
starter = {};
};
};
comment-nvim = {
enable = true;
preHook = ''
require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook()
'';
};
markdown-preview = {
enable = true;
settings.auto_start = true;
};
# rest.enable = true;
# treesitter-context = {
# maxLines = 3;
# mode = "topline";
# enable = true;
# };
noice = {
enable = true;
notify.enabled = false;
lsp.override = {
"vim.lsp.util.convert_input_to_markdown_lines" = true;
"vim.lsp.util.stylize_markdown" = true;
"cmp.entry.get_documentation" = true;
};
presets = {
bottom_search = false;
command_palette = true;
long_message_to_split = true;
inc_rename = false;
lsp_doc_border = true;
};
};
treesitter = {
enable = true;
indent = true;
folding = true;
grammarPackages =
pkgs.vimPlugins.nvim-treesitter.allGrammars
++ (with pkgs.tree-sitter-grammars; [
tree-sitter-just
tree-sitter-nu
tree-sitter-norg-meta
]);
};
telescope = {
enable = true;
extensions = {
undo.enable = true;
ui-select.enable = true;
fzf-native.enable = true;
file_browser.enable = true;
};
};
fidget = {
enable = true;
notification.overrideVimNotify = true;
};
dap = {
enable = true;
extensions = {
dap-ui.enable = true;
dap-virtual-text.enable = true;
};
};
nvim-ufo = {
enable = true;
closeFoldKinds = null;
# providerSelector =
# /*
# lua
# */
# ''
# function(bufnr, filetype, buftype)
# return {'treesitter', 'indent'}
# end
# '';
};
rustaceanvim = {
enable = true;
server = {
onAttach =
/*
lua
*/
''
function(client, bufnr)
if client.server_capabilities.inlayHintProvider then
vim.lsp.inlay_hint.enable(bufnr, true)
end
end
'';
settings =
/*
lua
*/
''
function(project_root)
local ra = require('rustaceanvim.config.server')
return ra.load_rust_analyzer_settings(project_root, {
settings_file_pattern = 'rust-analyzer.json'
})
end
'';
};
dap = {
autoloadConfigurations = false;
};
};
lsp = { lsp = {
enable = true; enable = true;
servers = { servers = {
@@ -59,7 +223,6 @@ in {
end end
''; '';
}; };
cmp = { cmp = {
enable = true; enable = true;
settings = { settings = {
@@ -116,193 +279,6 @@ in {
''; '';
}; };
}; };
noice = {
enable = true;
notify.enabled = false;
lsp.override = {
"vim.lsp.util.convert_input_to_markdown_lines" = true;
"vim.lsp.util.stylize_markdown" = true;
"cmp.entry.get_documentation" = true;
};
presets = {
bottom_search = false;
command_palette = true;
long_message_to_split = true;
inc_rename = false;
lsp_doc_border = true;
};
};
fidget = {
enable = true;
notification.overrideVimNotify = true;
};
trouble.enable = true;
rustaceanvim = {
enable = true;
server = {
onAttach =
/*
lua
*/
''
function(client, bufnr)
if client.server_capabilities.inlayHintProvider then
vim.lsp.inlay_hint.enable(bufnr, true)
end
client.server_capabilities.textDocument.foldingRange = {
dynamicRegistration = false,
lineFoldingOnly = true
}
end
'';
settings =
/*
lua
*/
''
function(project_root)
local ra = require('rustaceanvim.config.server')
return ra.load_rust_analyzer_settings(project_root, {
settings_file_pattern = 'rust-analyzer.json'
})
end
'';
};
dap = {
autoloadConfigurations = false;
};
};
oil.enable = true;
dap = {
enable = true;
extensions = {
dap-ui.enable = true;
dap-virtual-text.enable = true;
};
};
todo-comments.enable = true;
lualine.enable = true;
commentary.enable = true;
surround.enable = true;
which-key.enable = true;
nvim-ufo = {
enable = true;
closeFoldKinds = null;
# providerSelector =
# /*
# lua
# */
# ''
# function(bufnr, filetype, buftype)
# return {'treesitter', 'indent'}
# end
# '';
};
fugitive.enable = true;
markdown-preview = {
enable = true;
settings.auto_start = true;
};
# rest.enable = true;
treesitter-context = {
maxLines = 3;
mode = "topline";
enable = true;
};
ts-context-commentstring.enable = true;
treesitter = {
enable = true;
indent = true;
folding = true;
grammarPackages =
pkgs.vimPlugins.nvim-treesitter.allGrammars
++ (with pkgs.tree-sitter-grammars; [
tree-sitter-just
tree-sitter-nu
tree-sitter-norg-meta
]);
};
telescope = {
enable = true;
extensions = {
undo.enable = true;
ui-select.enable = true;
fzf-native.enable = true;
file_browser.enable = true;
};
};
mini = {
enable = true;
modules = {
ai = {};
starter = {};
# pairs.enable = true;
# cursorword.enable = true;
};
};
};
extraPlugins = with pkgs.vimPlugins; [
# neorg
neorg
neorg-telescope
# Wut
ChatGPT-nvim
# UI and UX
vim-abolish
octo-nvim
neoscroll-nvim
# Debuggging
nvim-dap-rr
# Treesitter stuff
outline-nvim
# lsp stuff
copilot-lua
crates-nvim
# No more postman
rest-nvim
# UI
nvim-web-devicons
# Utils
FTerm-nvim
plenary-nvim
pkgs.tree-sitter-grammars.tree-sitter-just
pkgs.tree-sitter-grammars.tree-sitter-nu
# Testing
neotest
# neotest-rust
];
options = {
shell = "sh";
number = true;
relativenumber = true;
tabstop = 4;
softtabstop = 4;
shiftwidth = 4;
expandtab = true;
hidden = true;
smartcase = true;
termguicolors = true;
signcolumn = "yes";
wrap = true;
completeopt = "menu,menuone,popup,noselect";
undodir = "${config.xdg.cacheHome}/undodir";
undofile = true;
viewoptions = "cursor,folds";
}; };
globals = { globals = {
mapleader = " "; mapleader = " ";
@@ -505,30 +481,90 @@ in {
end end
do -- do
function setup() -- function setup()
local capabilities = vim.lsp.protocol.make_client_capabilities() -- local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.foldingRange = { -- capabilities.textDocument.foldingRange = {
dynamicRegistration = false, -- dynamicRegistration = false,
lineFoldingOnly = true -- lineFoldingOnly = true
} -- }
-- local language_servers = require("lspconfig").util.available_servers() -- or list servers manually like {'gopls', 'clangd'} -- -- local language_servers = require("lspconfig").util.available_servers() -- or list servers manually like {'gopls', 'clangd'}
local language_servers = {"nil_ls"}; -- local language_servers = {"nil_ls"};
for _, ls in ipairs(language_servers) do -- for _, ls in ipairs(language_servers) do
require('lspconfig')[ls].setup({ -- require('lspconfig')[ls].setup({
capabilities = capabilities -- capabilities = capabilities
-- you can add other fields for setting up lsp server in this table -- -- you can add other fields for setting up lsp server in this table
}) -- })
end -- end
end -- end
success, output = pcall(setup) -- success, output = pcall(setup)
if not success then -- if not success then
print("Failed to setup lspconfig folds: " .. output) -- print("Failed to setup lspconfig folds: " .. output)
end -- end
end -- end
require('ufo').setup()
require('lspconfig.ui.windows').default_options.border = 'single' require('lspconfig.ui.windows').default_options.border = 'single'
catcher(require('nvim_context_vt').setup)
''; '';
package = pkgs.neovim-nightly; package = pkgs.neovim-nightly;
options = {
shell = "sh";
number = true;
relativenumber = true;
tabstop = 4;
softtabstop = 4;
shiftwidth = 4;
expandtab = true;
hidden = true;
smartcase = true;
termguicolors = true;
signcolumn = "yes";
wrap = true;
completeopt = "menu,menuone,popup,noselect";
undodir = "${config.xdg.cacheHome}/undodir";
undofile = true;
viewoptions = "cursor,folds";
};
extraPlugins = with pkgs.vimPlugins; [
# neorg
neorg
neorg-telescope
# Wut
ChatGPT-nvim
# UI and UX
vim-abolish
octo-nvim
neoscroll-nvim
# Debuggging
nvim-dap-rr
# Treesitter stuff
outline-nvim
# lsp stuff
copilot-lua
crates-nvim
# No more postman
rest-nvim
# UI
nvim-web-devicons
# Utils
FTerm-nvim
plenary-nvim
pkgs.tree-sitter-grammars.tree-sitter-just
pkgs.tree-sitter-grammars.tree-sitter-nu
# Testing
neotest
# neotest-rust
nvim_context_vt
];
}; };
} }

72
flake.lock generated
View File

@@ -675,11 +675,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1711122977, "lastModified": 1711133180,
"narHash": "sha256-EnHux7wf7/7r+YMv8d/Ym1OTllp4sqqq0Bws1a4s2Zo=", "narHash": "sha256-WJOahf+6115+GMl3wUfURu8fszuNeJLv9qAWFQl3Vmo=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "19b87b9ae6ecfd81104a2a36ef8364f1de1b54b1", "rev": "1c2c5e4cabba4c43504ef0f8cc3f3dfa284e2dbb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -696,11 +696,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1710974515, "lastModified": 1711133180,
"narHash": "sha256-jZpdsypecYTOO9l12Vy77otGmh9uz8tGzcguifA30Vs=", "narHash": "sha256-WJOahf+6115+GMl3wUfURu8fszuNeJLv9qAWFQl3Vmo=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "1c2acec99933f9835cc7ad47e35303de92d923a4", "rev": "1c2c5e4cabba4c43504ef0f8cc3f3dfa284e2dbb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -739,11 +739,11 @@
"systems": "systems_4" "systems": "systems_4"
}, },
"locked": { "locked": {
"lastModified": 1711101603, "lastModified": 1711228014,
"narHash": "sha256-5/uA1LoIQ6BhvABbTy46w97vO+q5jcngZ4BOsJtKiXs=", "narHash": "sha256-AF5i25DEYK7bLevSivoNwyLlQ55sLgTIBJaiS8WWEvU=",
"owner": "hyprwm", "owner": "hyprwm",
"repo": "hyprlock", "repo": "hyprlock",
"rev": "0db5afb9d618571048bc30958e10b1990130bbb4", "rev": "2448774de3532e8fdc65b329831ff37208e20f38",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -762,11 +762,11 @@
"rust-overlay": "rust-overlay_3" "rust-overlay": "rust-overlay_3"
}, },
"locked": { "locked": {
"lastModified": 1710805279, "lastModified": 1711145371,
"narHash": "sha256-C+ebLZsk+R9402NUZpcPFjGUo73+ut2EDrWGMkp41R4=", "narHash": "sha256-PfnORvxKgKzy7aZD2azOWBbZo7LKAsvQ3bGXJPOvNXA=",
"owner": "JakeStanger", "owner": "JakeStanger",
"repo": "ironbar", "repo": "ironbar",
"rev": "82546275959970b1dad409c03f8ad3a29e95243a", "rev": "f9c746a7c32ae0818fade2f60adeffe8d779800a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -853,11 +853,11 @@
}, },
"locked": { "locked": {
"dir": "contrib", "dir": "contrib",
"lastModified": 1711063903, "lastModified": 1711232369,
"narHash": "sha256-O0xgUE0BPHiVVoHm/WnRBZMCW5qJSuqPZZhVqF6uZv8=", "narHash": "sha256-8e456HSCTA7IhCzxJcKoWERWpgZ624LX5E3U9Ny3vwU=",
"owner": "neovim", "owner": "neovim",
"repo": "neovim", "repo": "neovim",
"rev": "15c6909bb198ca8a1a22405a4a7e96357716e57e", "rev": "d3e51603bc94fac68cd2c92ae7ebc90baa8471fe",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -878,11 +878,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1711065810, "lastModified": 1711238673,
"narHash": "sha256-QasZbe7PZF/e0i3SAKhKoF6LCXJ2QdtAgbFAdpYCrFA=", "narHash": "sha256-+RQ20E5N6bQcZtSuwIx+4ELFwbfMOZ7W7tgrU9vxdA8=",
"owner": "nix-community", "owner": "nix-community",
"repo": "neovim-nightly-overlay", "repo": "neovim-nightly-overlay",
"rev": "278fc96760142b5e569636776344f3af16e281ee", "rev": "dc1d09c95137ce5b6889f4266ea7301d2af071f1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -937,11 +937,11 @@
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1710644923, "lastModified": 1711249705,
"narHash": "sha256-0fjbN5GYYDKPyPay0l8gYoH+tFfNqPPwP5sxxBreeA4=", "narHash": "sha256-h/NQECj6mIzF4XR6AQoSpkCnwqAM+ol4+qOdYi2ykmQ=",
"owner": "Mic92", "owner": "Mic92",
"repo": "nix-index-database", "repo": "nix-index-database",
"rev": "e25efda85e39fcdc845e371971ac4384989c4295", "rev": "34519f3bb678a5abbddf7b200ac5347263ee781b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -986,11 +986,11 @@
}, },
"nixpkgs-main": { "nixpkgs-main": {
"locked": { "locked": {
"lastModified": 1711127751, "lastModified": 1711291124,
"narHash": "sha256-AnIoFk9LTj+z1QRvKGrbucIL1AFElQZYfamyInBB1Gs=", "narHash": "sha256-YX5pyNBBQCIIaap3D58aE41qTwdzIzDaViIapO30S9g=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d089679c701bd6de3785d7ebfda68c0ba36221f7", "rev": "c5dd6acd6c243bcf29d0c5e54733bb3576f28c2e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1047,11 +1047,11 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1710451336, "lastModified": 1711163522,
"narHash": "sha256-pP86Pcfu3BrAvRO7R64x7hs+GaQrjFes+mEPowCfkxY=", "narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d691274a972b3165335d261cc4671335f5c67de9", "rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1063,11 +1063,11 @@
}, },
"nixpkgs_5": { "nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1711001935, "lastModified": 1711163522,
"narHash": "sha256-URtGpHue7HHZK0mrHnSf8wJ6OmMKYSsoLmJybrOLFSQ=", "narHash": "sha256-YN/Ciidm+A0fmJPWlHBGvVkcarYWSC+s3NTPk/P+q3c=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "20f77aa09916374aa3141cbc605c955626762c9a", "rev": "44d0940ea560dee511026a53f0e2e2cde489b4d4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1090,11 +1090,11 @@
"pre-commit-hooks": "pre-commit-hooks" "pre-commit-hooks": "pre-commit-hooks"
}, },
"locked": { "locked": {
"lastModified": 1711124705, "lastModified": 1711284540,
"narHash": "sha256-vgFQxvs6T9RcaV9sd9Io+RxQuRKovauMvueGajWWanw=", "narHash": "sha256-DTzi4ujZoxM3ZXStCwD6Lph3FdGtkBlvfYsDCRITjfA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "822ec15646b8f7b621468b503118921d644acf39", "rev": "e7a3461fefd983ae3443e9aa849e9d1566ab47e4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1105,11 +1105,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1711124939, "lastModified": 1711290879,
"narHash": "sha256-IBXc/O+T5ZLBrC6ognGgaDDVOkN0rXHYk2DXmy6OP6o=", "narHash": "sha256-VSDs6VjMZx/ZucNE/mogKuiZQb1HflbEaT/yiTuJ+oQ=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nur", "repo": "nur",
"rev": "f9e330219c525b46c8bdf71996a5f45310c741bc", "rev": "0e2ba010cca9f9001f904b5a23de4c84cdc3bec9",
"type": "github" "type": "github"
}, },
"original": { "original": {