From 7df80623d52fcb9a84320ba59c917b570d1fd03e Mon Sep 17 00:00:00 2001 From: biscuit Date: Tue, 3 Jun 2025 04:21:36 -0500 Subject: [PATCH] test --- custom/neovim/config/dashboard.nix | 174 ++++++++++++++++++++ custom/neovim/config/default.nix | 2 +- custom/neovim/config/languange.nix | 246 +++++++++++++++++++++++++++++ custom/neovim/flake.lock | 219 +++++++++++++++++++++++++ custom/neovim/flake.nix | 3 +- 5 files changed, 641 insertions(+), 3 deletions(-) create mode 100644 custom/neovim/config/dashboard.nix create mode 100644 custom/neovim/config/languange.nix create mode 100644 custom/neovim/flake.lock diff --git a/custom/neovim/config/dashboard.nix b/custom/neovim/config/dashboard.nix new file mode 100644 index 0000000..480d83c --- /dev/null +++ b/custom/neovim/config/dashboard.nix @@ -0,0 +1,174 @@ +{ + plugins = { + alpha = { + enable = true; + layout = [ + { + type = "padding"; + val = 2; + } + { + type = "text"; + val = [ + " █████ █ ██" + " ██████ ██ ████ █ █" + " ██ █ █ ██ ████ ██ ███" + " █ █ █ ██ █ █ ██ █" + " █ █ ██ █ ████ ██ ███" + " ██ ██ ██ █ ███ █ ███ █ ██ ███ ███ ███ ████ ████" + " ██ ██ ██ █ █ ███ █ ████ ██ ███ ███ ███ ████ ███ █" + " ██ ██ ██ █ █ ███ ██ ██ ██ ██ ██ ██ ████ ████" + " ██ ██ ██ █ ██ █████ ██ ██ ██ ██ ██ ██ ██" + " ██ ██ ██ █ ████████ ██ ██ ██ ██ ██ ██ ██ ██" + " █ ██ ███ ███████ ██ ██ ██ ██ ██ ██ ██ ██" + " █ ███ ██ ██ ██ ██ █ ██ ██ ██ ██" + " ████ ██ ████ █ ██████ ███████ ██ ██ ██ ██" + " █ █████ ███████ ████ █████ ███ █ ███ ███ ███" + " █ ██ █████ ███ ███ ███ ███" + " █" + " █" + " ██" + ]; + opts = { + position = "center"; + hl = "Type"; + }; + } + { + type = "padding"; + val = 4; + } + { + type = "group"; + val = [ + { + type = "button"; + val = "  New File "; + on_press.__raw = "function() vim.cmd[[ene]] end"; + opts = { + shortcut = "n"; + keymap = [ + "n" + "n" + "ene" + { + noremap = true; + silent = true; + nowait = true; + } + ]; + position = "center"; + width = 50; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + { + type = "padding"; + val = 2; + } + { + type = "button"; + val = "  Find File "; + opts = { + shortcut = "f"; + keymap = [ + "n" + "f" + "lua require('fzf-lua').files({ cwd = vim.loop.cwd() })" + { + noremap = true; + silent = true; + nowait = true; + } + ]; + position = "center"; + width = 50; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + { + type = "padding"; + val = 2; + } + { + type = "button"; + val = "  Recent Files "; + on_press.__raw = "function() require('telescope.builtin').oldfiles() end"; + opts = { + shortcut = "r"; + keymap = [ + "n" + "r" + "lua require('fzf-lua').oldfiles({ cwd = vim.loop.cwd() })" + { + noremap = true; + silent = true; + nowait = true; + } + ]; + position = "center"; + width = 50; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + { + type = "padding"; + val = 2; + } + { + type = "button"; + val = "  Find Text "; + on_press.__raw = "function() require('telescope.builtin').live_grep() end"; + opts = { + shortcut = "g"; + keymap = [ + "n" + "g" + "lua require('fzf-lua').live_grep()" + { + noremap = true; + silent = true; + nowait = true; + } + ]; + position = "center"; + width = 50; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + { + type = "padding"; + val = 2; + } + { + type = "button"; + val = "  Quit Neovim "; + on_press.__raw = "function() vim.cmd[[qa]] end"; + opts = { + shortcut = "q"; + keymap = [ + "n" + "q" + "qa" + { + noremap = true; + silent = true; + nowait = true; + } + ]; + position = "center"; + width = 50; + align_shortcut = "right"; + hl_shortcut = "Keyword"; + }; + } + ]; + } + ]; + }; + }; +} diff --git a/custom/neovim/config/default.nix b/custom/neovim/config/default.nix index 2f30e11..672d45b 100644 --- a/custom/neovim/config/default.nix +++ b/custom/neovim/config/default.nix @@ -1,6 +1,6 @@ let files = builtins.readDir ./.; - nixFiles = builtins.filter (name: name != "default.nix" && builtins.match ".*\\.nix" name != null) (builtins.attrName files); + nixFiles = builtins.filter (name: name != "default.nix" && builtins.match ".*\\.nix" name != null) (builtins.attrNames files); imports = map (name: ./. + "/${name}") nixFiles; in { imports = imports; diff --git a/custom/neovim/config/languange.nix b/custom/neovim/config/languange.nix new file mode 100644 index 0000000..997b5f5 --- /dev/null +++ b/custom/neovim/config/languange.nix @@ -0,0 +1,246 @@ +let + selectOpts = '' + { + behavior = cmp.SelectBehavior.Insert + } + ''; +in + {pkgs, ...}: { + plugins = { + avante.enable = true; + cmp = { + enable = true; + settings = { + autoEnableSources = true; + performance = { + debounce = 150; + }; + sources = [ + {name = "path";} + { + name = "nvim_lsp"; + keywordLength = 1; + } + { + name = "buffer"; + keywordLength = 3; + } + {name = "luasnip";} + ]; + + snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; + formatting = { + fields = [ + "abbr" + "kind" + "menu" + ]; + # format = lspkindFormat; + }; + + mapping = { + "" = "cmp.mapping.select_prev_item(${selectOpts})"; + "" = "cmp.mapping.select_next_item(${selectOpts})"; + + "" = "cmp.mapping.select_prev_item(${selectOpts})"; + "" = "cmp.mapping.select_next_item(${selectOpts})"; + + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.scroll_docs(4)"; + + "" = "cmp.mapping.abort()"; + "" = "cmp.mapping.confirm({select = true})"; + "" = "cmp.mapping.confirm({select = false})"; + + "" = '' + cmp.mapping( + function(fallback) + if luasnip.jumpable(1) then + luasnip.jump(1) + else + fallback() + end + end, + { "i", "s" } + ) + ''; + + "" = '' + cmp.mapping( + function(fallback) + if luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, + { "i", "s" } + ) + ''; + + "" = '' + cmp.mapping( + function(fallback) + local col = vim.fn.col('.') - 1 + + if cmp.visible() then + cmp.select_next_item(select_opts) + elseif col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then + fallback() + else + cmp.complete() + end + end, + { "i", "s" } + ) + ''; + + "" = '' + cmp.mapping( + function(fallback) + if cmp.visible() then + cmp.select_prev_item(select_opts) + else + fallback() + end + end, + { "i", "s" } + ) + ''; + }; + window = { + completion = { + border = "rounded"; + winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None"; + zindex = 1001; + scrolloff = 0; + colOffset = 0; + sidePadding = 1; + scrollbar = true; + }; + documentation = { + border = "rounded"; + winhighlight = "Normal:Normal,FloatBorder:Normal,CursorLine:Visual,Search:None"; + zindex = 1001; + maxHeight = 20; + }; + }; + }; + }; + cmp-nvim-lsp.enable = true; + lspkind.enable = true; + lspkind.cmp.enable = true; + luasnip.enable = true; + cmp-buffer.enable = true; + cmp-path.enable = true; + cmp-treesitter.enable = true; + dap.enable = true; + none-ls = { + enable = true; + sources.formatting = { + alejandra.enable = true; + hclfmt.enable = true; + just.enable = true; + opentofu_fmt.enable = true; + prettier.enable = true; + rubocop.enable = true; + sqlformat.enable = true; + stylua.enable = true; + yamlfmt.enable = true; + }; + sources.diagnostics = { + trivy.enable = true; + yamllint.enable = true; + }; + }; + + conform-nvim = { + enable = true; + settings = { + format_on_save = { + lsp_fallback = "fallback"; + timeout_ms = 500; + }; + notify_on_error = true; + + formatters_by_ft = { + css = ["prettier"]; + html = ["prettier"]; + json = ["prettier"]; + just = ["just"]; + lua = ["stylua"]; + nix = ["alejandra"]; + ruby = ["rubocop"]; + terraform = ["tofu_fmt"]; + tf = ["tofu_fmt"]; + yaml = ["yamlfmt"]; + }; + }; + }; + + lsp = { + enable = true; + inlayHints = true; + keymaps = { + diagnostic = { + "E" = "open_float"; + "[" = "goto_prev"; + "]" = "goto_next"; + "do" = "setloclist"; + }; + lspBuf = { + "K" = "hover"; + "gD" = "declaration"; + "gd" = "definition"; + "gr" = "references"; + "gI" = "implementation"; + "gy" = "type_definition"; + "ca" = "code_action"; + "cr" = "rename"; + "wl" = "list_workspace_folders"; + "wr" = "remove_workspace_folder"; + "wa" = "add_workspace_folder"; + }; + }; + preConfig = '' + vim.diagnostic.config({ + virtual_text = false, + severity_sort = true, + float = { + border = 'rounded', + source = 'always', + }, + }) + + vim.lsp.handlers['textDocument/hover'] = vim.lsp.with( + vim.lsp.handlers.hover, + {border = 'rounded'} + ) + + vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with( + vim.lsp.handlers.signature_help, + {border = 'rounded'} + ) + ''; + postConfig = '' + local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" }) + end + ''; + servers = { + jsonls.enable = true; + marksman.enable = true; + nil_ls.enable = true; + nixd.enable = true; + yamlls.enable = true; + taplo.enable = true; + }; + }; + + trouble = { + enable = true; + }; + }; + } diff --git a/custom/neovim/flake.lock b/custom/neovim/flake.lock new file mode 100644 index 0000000..9df228e --- /dev/null +++ b/custom/neovim/flake.lock @@ -0,0 +1,219 @@ +{ + "nodes": { + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1748821116, + "narHash": "sha256-F82+gS044J1APL0n4hH50GYdPRv/5JWm34oCJYmVKdE=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "49f0870db23e8c1ca0b5259734a02cd9e1e371a1", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1743550720, + "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "c621e8422220273271f52058f618c94e405bb0f5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "ixx": { + "inputs": { + "flake-utils": [ + "nixvim", + "nuschtosSearch", + "flake-utils" + ], + "nixpkgs": [ + "nixvim", + "nuschtosSearch", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748294338, + "narHash": "sha256-FVO01jdmUNArzBS7NmaktLdGA5qA3lUMJ4B7a05Iynw=", + "owner": "NuschtOS", + "repo": "ixx", + "rev": "cc5f390f7caf265461d4aab37e98d2292ebbdb85", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "ref": "v0.0.8", + "repo": "ixx", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1748693115, + "narHash": "sha256-StSrWhklmDuXT93yc3GrTlb0cKSS0agTAxMGjLKAsY8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "910796cabe436259a29a72e8d3f5e180fc6dfacc", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1748740939, + "narHash": "sha256-rQaysilft1aVMwF14xIdGS3sj1yHlI6oKQNBRTF40cc=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "656a64127e9d791a334452c6b6606d17539476e2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1748406211, + "narHash": "sha256-B3BsCRbc+x/d0WiG1f+qfSLUy+oiIfih54kalWBi+/M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3d1f29646e4b57ed468d60f9d286cde23a8d1707", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs_2", + "nuschtosSearch": "nuschtosSearch", + "systems": "systems_2" + }, + "locked": { + "lastModified": 1748884506, + "narHash": "sha256-P/ldKE0SCGKH6pEVJoW2MJJo2dZCZe10d/h1ree66c0=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "d063d0dd5e0b82d8be4dd4bc00b887ac1f92e4b2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "nuschtosSearch": { + "inputs": { + "flake-utils": "flake-utils", + "ixx": "ixx", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748298102, + "narHash": "sha256-PP11GVwUt7F4ZZi5A5+99isuq39C59CKc5u5yVisU/U=", + "owner": "NuschtOS", + "repo": "search", + "rev": "f8a1c221afb8b4c642ed11ac5ee6746b0fe1d32f", + "type": "github" + }, + "original": { + "owner": "NuschtOS", + "repo": "search", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "nixvim": "nixvim" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "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" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/custom/neovim/flake.nix b/custom/neovim/flake.nix index 895b8bc..92707f3 100644 --- a/custom/neovim/flake.nix +++ b/custom/neovim/flake.nix @@ -8,7 +8,6 @@ outputs = { nixvim, flake-parts, - rust-overlay, ... } @ inputs: flake-parts.lib.mkFlake {inherit inputs;} { @@ -19,7 +18,7 @@ "aarch64-darwin" ]; perSystem = {system, ...}: let - overlays = [(import rust-overlay)]; + overlays = []; nixvimLib = nixvim.lib.${system}; nixvim' = nixvim.legacyPackages.${system}; baseNixvimModule = {