mirror of
https://github.com/tuxdotrs/tnvim.git
synced 2025-07-06 21:36:34 +05:30
repalce astrovim with nvchad
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
{ inputs, pkgs, ... }: {
|
||||
|
||||
xdg.configFile = {
|
||||
"nvim".source = inputs.astronvim;
|
||||
"astronvim".source = ./astronvim;
|
||||
source = "${pkgs.nvchad}";
|
||||
};
|
||||
|
||||
programs = {
|
||||
@ -21,48 +21,13 @@
|
||||
packages = with pkgs; [
|
||||
gcc
|
||||
neovide
|
||||
#-- python
|
||||
nodePackages.pyright # python language server
|
||||
python311Packages.black # python formatter
|
||||
|
||||
#-- nix
|
||||
nil
|
||||
rnix-lsp
|
||||
# nix
|
||||
statix # Lints and suggestions for the nix programming language
|
||||
deadnix # Find and remove unused code in .nix source files
|
||||
alejandra # Nix Code Formatter
|
||||
|
||||
#-- golang
|
||||
go
|
||||
gomodifytags
|
||||
iferr # generate error handling code for go
|
||||
impl # generate function implementation for go
|
||||
gotools # contains tools like: godoc, goimports, etc.
|
||||
gopls # go language server
|
||||
delve # go debugger
|
||||
|
||||
#-- lua
|
||||
stylua
|
||||
lua-language-server
|
||||
luarocks
|
||||
|
||||
#-- bash
|
||||
nodePackages.bash-language-server
|
||||
shellcheck
|
||||
shfmt
|
||||
|
||||
#-- javascript/typescript --#
|
||||
nodePackages.typescript
|
||||
nodePackages.typescript-language-server
|
||||
|
||||
#-- Misc
|
||||
hadolint # Dockerfile linter
|
||||
tree-sitter # common language parser/highlighter
|
||||
nodePackages.prettier # common code formatter
|
||||
|
||||
#-- Optional Requirements:
|
||||
gdu # disk usage analyzer, required by AstroNvim
|
||||
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
|
||||
gdu
|
||||
ripgrep
|
||||
];
|
||||
};
|
||||
}
|
||||
|
22
pkgs/nvchad/custom/chadrc.lua
Normal file
22
pkgs/nvchad/custom/chadrc.lua
Normal file
@ -0,0 +1,22 @@
|
||||
local M = {}
|
||||
|
||||
M.ui = {
|
||||
theme = "oxocarbon",
|
||||
transparency = true,
|
||||
nvdash = {
|
||||
load_on_startup = true,
|
||||
|
||||
header = {
|
||||
"|------------------------|",
|
||||
"| NOBODY FUX WITH TUX |",
|
||||
"|------------------------|",
|
||||
" \\ (•◡•) / ",
|
||||
" \\ / ",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
M.mappings = require "custom.mappings"
|
||||
M.plugins = "custom.plugins"
|
||||
|
||||
return M
|
21
pkgs/nvchad/custom/configs/conform.lua
Normal file
21
pkgs/nvchad/custom/configs/conform.lua
Normal file
@ -0,0 +1,21 @@
|
||||
local prettier = { "prettierd", "prettier" }
|
||||
|
||||
local options = {
|
||||
lsp_fallback = true,
|
||||
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
javascript = { prettier },
|
||||
typescript = { prettier },
|
||||
javascriptreact = { prettier },
|
||||
typescriptreact = { prettier },
|
||||
json = { prettier },
|
||||
jsonc = { prettier },
|
||||
css = { prettier },
|
||||
html = { prettier },
|
||||
markdown = { prettier },
|
||||
nix = { "alejandra" },
|
||||
},
|
||||
}
|
||||
|
||||
require("conform").setup(options)
|
32
pkgs/nvchad/custom/configs/lspconfig.lua
Normal file
32
pkgs/nvchad/custom/configs/lspconfig.lua
Normal file
@ -0,0 +1,32 @@
|
||||
local configs = require "plugins.configs.lspconfig"
|
||||
local on_attach = configs.on_attach
|
||||
local capabilities = configs.capabilities
|
||||
|
||||
local lspconfig = require "lspconfig"
|
||||
-- local util = require "lspconfig/util"
|
||||
|
||||
local servers = { "tsserver", "tailwindcss", "eslint" }
|
||||
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end
|
||||
|
||||
-- lspconfig.gopls.setup {
|
||||
-- on_attach = on_attach,
|
||||
-- capabilities = capabilities,
|
||||
-- cmd = { "gopls" },
|
||||
-- filetypes = { "go", "gomod", "gowork", "gotmpl" },
|
||||
-- root_dir = util.root_pattern("go.work", "go.mod", ".git"),
|
||||
-- settings = {
|
||||
-- gopls = {
|
||||
-- completeUnimported = true,
|
||||
-- usePlaceholders = true,
|
||||
-- analyses = {
|
||||
-- unusedparams = true,
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
16
pkgs/nvchad/custom/configs/noice.lua
Normal file
16
pkgs/nvchad/custom/configs/noice.lua
Normal file
@ -0,0 +1,16 @@
|
||||
local opts = {
|
||||
lsp = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
},
|
||||
presets = {
|
||||
long_message_to_split = true, -- long messages will be sent to a split
|
||||
inc_rename = false, -- enables an input dialog for inc-rename.nvim
|
||||
lsp_doc_border = false, -- add a border to hover docs and signature help
|
||||
},
|
||||
}
|
||||
|
||||
return opts
|
33
pkgs/nvchad/custom/configs/null-ls.lua
Normal file
33
pkgs/nvchad/custom/configs/null-ls.lua
Normal file
@ -0,0 +1,33 @@
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
local null_ls = require "null-ls"
|
||||
|
||||
local b = null_ls.builtins
|
||||
|
||||
local opts = {
|
||||
sources = {
|
||||
b.formatting.prettierd,
|
||||
b.formatting.stylua,
|
||||
|
||||
-- nix
|
||||
b.code_actions.statix,
|
||||
b.formatting.alejandra,
|
||||
b.diagnostics.deadnix,
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method "textDocument/formatting" then
|
||||
vim.api.nvim_clear_autocmds {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
}
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format { bufnr = bufnr }
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
return opts
|
57
pkgs/nvchad/custom/configs/overrides.lua
Normal file
57
pkgs/nvchad/custom/configs/overrides.lua
Normal file
@ -0,0 +1,57 @@
|
||||
local M = {}
|
||||
|
||||
M.treesitter = {
|
||||
ensure_installed = {
|
||||
-- defaults
|
||||
"vim",
|
||||
"lua",
|
||||
|
||||
-- web dev
|
||||
"html",
|
||||
"css",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"tsx",
|
||||
|
||||
-- nix
|
||||
"nix",
|
||||
},
|
||||
}
|
||||
|
||||
M.mason = {
|
||||
ensure_installed = {
|
||||
-- defaults
|
||||
"lua-language-server",
|
||||
"stylua",
|
||||
|
||||
-- web dev
|
||||
"css-lsp",
|
||||
"html-lsp",
|
||||
"prettierd",
|
||||
"eslint-lsp",
|
||||
"typescript-language-server",
|
||||
"tailwindcss-language-server",
|
||||
|
||||
-- nix
|
||||
"nil",
|
||||
},
|
||||
}
|
||||
|
||||
M.nvterm = {
|
||||
terminals = {
|
||||
shell = vim.o.shell,
|
||||
list = {},
|
||||
type_opts = {
|
||||
float = {
|
||||
relative = "editor",
|
||||
row = 0.23,
|
||||
col = 0.15,
|
||||
width = 0.7,
|
||||
height = 0.5,
|
||||
border = "single",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
3
pkgs/nvchad/custom/init.lua
Normal file
3
pkgs/nvchad/custom/init.lua
Normal file
@ -0,0 +1,3 @@
|
||||
local opt = vim.opt
|
||||
|
||||
opt.relativenumber = true
|
27
pkgs/nvchad/custom/mappings.lua
Normal file
27
pkgs/nvchad/custom/mappings.lua
Normal file
@ -0,0 +1,27 @@
|
||||
local M = {}
|
||||
|
||||
M.nvterm = {
|
||||
t = {
|
||||
["<F7>"] = {
|
||||
function()
|
||||
require("nvterm.terminal").toggle "float"
|
||||
end,
|
||||
"Toggle floating term",
|
||||
},
|
||||
},
|
||||
n = {
|
||||
["<F7>"] = {
|
||||
function()
|
||||
require("nvterm.terminal").toggle "float"
|
||||
end,
|
||||
"Toggle floating term",
|
||||
},
|
||||
["<leader>Sl"] = { "<cmd>SessionManager! load_last_session<cr>", desc = "Load last session" },
|
||||
["<leader>Ss"] = { "<cmd>SessionManager! save_current_session<cr>", desc = "Save this session" },
|
||||
["<leader>Sd"] = { "<cmd>SessionManager! delete_session<cr>", desc = "Delete session" },
|
||||
["<leader>Sf"] = { "<cmd>SessionManager! load_session<cr>", desc = "Search sessions" },
|
||||
["<leader>S."] = { "<cmd>SessionManager! load_current_dir_session<cr>", desc = "Load current directory session" },
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
59
pkgs/nvchad/custom/plugins.lua
Normal file
59
pkgs/nvchad/custom/plugins.lua
Normal file
@ -0,0 +1,59 @@
|
||||
local overrides = require "custom.configs.overrides"
|
||||
|
||||
local plugins = {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = overrides.treesitter,
|
||||
},
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = overrides.mason,
|
||||
},
|
||||
{
|
||||
"NvChad/nvterm",
|
||||
opts = overrides.nvterm,
|
||||
},
|
||||
{
|
||||
"Shatur/neovim-session-manager",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"stevearc/dressing.nvim",
|
||||
},
|
||||
event = "BufWritePost",
|
||||
cmd = "SessionManager",
|
||||
},
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
"rcarriga/nvim-notify",
|
||||
},
|
||||
opts = function()
|
||||
return require "custom.configs.noice"
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
require "plugins.configs.lspconfig"
|
||||
require "custom.configs.lspconfig"
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
return require "custom.configs.null-ls"
|
||||
end,
|
||||
},
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
ft = { "javascript", "javascriptreact", "typescript", "typescriptreact" },
|
||||
config = function()
|
||||
require("nvim-ts-autotag").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
return plugins
|
30
pkgs/nvchad/default.nix
Normal file
30
pkgs/nvchad/default.nix
Normal file
@ -0,0 +1,30 @@
|
||||
{ lib, stdenv, pkgs }:
|
||||
|
||||
let
|
||||
custom = ./custom;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "nvchad";
|
||||
version = "2.0.0";
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "NvChad";
|
||||
repo = "NvChad";
|
||||
rev = "refs/heads/v2.0";
|
||||
# sha256 = "sha256-tKMvKdB3jPSvcyewaOe8oak3pXhjAcLyyxgGMiMeqeU=";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
cp -r * "$out/"
|
||||
mkdir -p "$out/lua/custom"
|
||||
cp -r ${custom}/* "$out/lua/custom/"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "NvChad";
|
||||
homepage = "https://github.com/NvChad/NvChad";
|
||||
platforms = platforms.all;
|
||||
license = licenses.gpl3;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user