diff --git a/common/home.nix b/common/home.nix index 0d4ed270..e0c5ce6c 100644 --- a/common/home.nix +++ b/common/home.nix @@ -31,6 +31,11 @@ gh just yarn + rustup + clang + cmake + alejandra + pkg-config # Misc qmk @@ -49,25 +54,18 @@ macchina ripgrep fd - alejandra dust cachix - rustup - cmake fzf - clang - nil - pkg-config - lua-language-server (nerdfonts.override {fonts = ["Hasklig"];}) pfetch-rs + mpv ] ++ lib.optionals device.isLinux [ psst sony-headphones-client abaddon rr - mpv catppuccinThemes.gtk catppuccinThemes.papirus-folders gnome.seahorse diff --git a/common/nvim.nix b/common/nvim.nix index f745670f..13e02ae9 100644 --- a/common/nvim.nix +++ b/common/nvim.nix @@ -32,7 +32,7 @@ in { ChatGPT-nvim # UI and UX - comfortable-motion + nvim-ufo vim-abolish telescope-nvim telescope-ui-select-nvim @@ -40,6 +40,7 @@ in { telescope-file-browser-nvim telescope-dap-nvim octo-nvim + neoscroll-nvim # Debuggging nvim-dap-rr @@ -61,17 +62,13 @@ in { cmp-git luasnip copilot-lua - lsp-zero-nvim crates-nvim sqls-nvim - rustaceanvim # No more postman - # rest-nvim.ftplugin rest-nvim # UI - noice-nvim nvim-web-devicons # Utils @@ -107,73 +104,72 @@ in { mapleader = " "; }; plugins = { - fidget.enable = true; + lsp = { + enable = true; + servers = { + gopls.enable = true; + nil_ls = { + enable = true; + settings = { + formatting = { + command = [ + "${pkgs.alejandra}/bin/alejandra" + # "${pkgs.nixfmt}/bin/nixfmt" + # "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt" + ]; + }; + }; + }; + clangd.enable = true; + lua-ls.enable = true; + jsonls.enable = true; + html.enable = true; + pylyzer.enable = true; + # rust-analyzer.enable = true; + }; + }; + + noice = { + enable = true; + notify.enabled = false; + }; + 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 + 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; + }; }; - # lspconfig = { - # enable = true; - # servers = { - # gopls.enable = true; - # nil = { - # enable = true; - # extraConfig = - # /* - # lua - # */ - # '' - # settings = { - # ['nil'] = { - # formatting = { - # -- command = { "$\{pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt" }, - # -- command = { "$\{pkgs.nixfmt}/bin/nixfmt" }, - # command = { "${pkgs.alejandra}/bin/alejandra" }, - # }, - # nix = { - # flake = { - # autoArchive = true, - # }, - # }, - # }, - # }, - # ''; - # }; - # clangd.enable = true; - # lua-language-server.enable = true; - # jsonls.enable = true; - # html.enable = true; - # # pylyzer.enable = true; - # sqls = { - # enable = true; - # onAttachExtra = - # /* - # lua - # */ - # '' - # require('sqls').on_attach(client, bufnr) - # ''; - # }; - # # rust-analyzer.enable = true; - # }; - # extraLua.pre = - # /* - # lua - # */ - # '' - # local lsp_zero = require'lsp-zero' - # local lspconfig = require 'lspconfig' - # lsp_zero.on_attach(function(client, bufnr) - # lsp_zero.default_keymaps({buffer = bufnr}) - # if client.server_capabilities.inlayHintProvider then - # vim.lsp.inlay_hint.enable(bufnr, true) - # end - # end) - # ''; - # # extraLua.post = '' - # # vim.lsp.inlay_hint.enable(bufnr, true) - # # ''; - # }; - oil.enable = true; dap = { enable = true; @@ -187,14 +183,30 @@ in { commentary.enable = true; surround.enable = true; which-key.enable = true; - nvim-ufo.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.enable = true; + # rest.enable = true; + treesitter-context = { + maxLines = 3; + mode = "topline"; + enable = true; + }; ts-context-commentstring.enable = true; treesitter = { @@ -207,16 +219,15 @@ in { tree-sitter-just tree-sitter-norg-meta ]); - # refactor = { - # smartRename = { - # enable = true; - # }; - # }; - # grammars = with pkgs.tree-sitter-grammars; [ - # tree-sitter-just - # tree-sitter-norg-meta - # ]; - # installAllGrammars = true; + }; + telescope = { + enable = true; + extensions = { + undo.enable = true; + ui-select.enable = true; + fzf-native.enable = true; + file_browser.enable = true; + }; }; mini = { @@ -242,13 +253,13 @@ in { "ee" = "[[Rest run]]"; "el" = "[[Rest run last]]"; "vff" = "[[vertical Gdiffsplit]]"; - "\\\"" = ''[["+]]''; + "\"" = ''[["+]]''; "gh" = "[[Octo actions]]"; "" = "''"; "q" = "[[bw]]"; "n" = "[[bnext]]"; "p" = "[[bprev]]"; - "\\\"" = "[[split]]"; + "\"" = "[[split]]"; "%" = "[[vsplit]]"; "dr" = "[[RustLsp debuggables]]"; "" = "[[Outline]]"; @@ -263,13 +274,13 @@ in { "F" = "function() vim.lsp.buf.format({ async = true }) end"; "bb" = "require'dap'.toggle_breakpoint"; "du" = "require'dapui'.toggle"; - "" = "require('FTerm').toggle"; + "" = "require('FTerm').toggle"; }; terminal = { - "" = "require('FTerm').toggle"; + "" = "require('FTerm').toggle"; }; insert = { - "" = "require('FTerm').toggle"; + "" = "require('FTerm').toggle"; }; }; @@ -298,64 +309,21 @@ in { } }) - -- do - -- function setup() - -- require('rest-nvim').setup() - -- end - -- success, output = pcall(setup) - -- if not success then - -- print("Failed to setup rest-nvim: " .. output) - -- end - -- end + do + function setup() + require('rest-nvim').setup() + end + success, output = pcall(setup) + if not success then + print("Failed to setup rest-nvim: " .. output) + end + end - require('telescope').setup { - defaults = { - initial_mode = 'insert', - }, - extensions = { - fzf = { - fuzzy = true, -- false will only do exact matching - override_generic_sorter = true, -- override the generic sorter - override_file_sorter = true, -- override the file sorter - case_mode = "smart_case", -- or "ignore_case" or "respect_case" - } - } - } - - require('telescope').load_extension("ui-select") require('telescope').load_extension("dap") - require('telescope').load_extension("fzf") - require('telescope').load_extension("file_browser") - require('telescope').load_extension("rest") + -- require('telescope').load_extension("rest") require('telescope').load_extension("neorg") - vim.g.rustaceanvim = { - tools = { - enable_clippy = false, - }, - server = { - capabilities = require 'lsp-zero'.get_capabilities(), - on_attach = function(client, bufnr) - if client.server_capabilities.inlayHintProvider then - vim.lsp.inlay_hint.enable(bufnr, true) - end - end, - settings = 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 = { - autoload_configurations = false, - ${pkgs.lib.optionalString device.isLinux '' - adapter = require'rustaceanvim.config'.get_codelldb_adapter("${codelldb}/bin/codelldb", "${liblldb}") - ''} - }, - } - require("copilot").setup({ suggestion = { enabled = true, @@ -434,24 +402,24 @@ in { }) require('crates').setup() require('outline').setup() - require("noice").setup({ - lsp = { - -- override markdown rendering so that **cmp** and other plugins use **Treesitter** - override = { - ["vim.lsp.util.convert_input_to_markdown_lines"] = true, - ["vim.lsp.util.stylize_markdown"] = true, - ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp - }, - }, - -- you can enable a preset for easier configuration - presets = { - bottom_search = false, -- use a classic bottom cmdline for search - command_palette = true, -- position the cmdline and popupmenu together - 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 = true, -- add a border to hover docs and signature help - }, - }) + -- require("noice").setup({ + -- lsp = { + -- -- override markdown rendering so that **cmp** and other plugins use **Treesitter** + -- override = { + -- ["vim.lsp.util.convert_input_to_markdown_lines"] = true, + -- ["vim.lsp.util.stylize_markdown"] = true, + -- ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp + -- }, + -- }, + -- -- you can enable a preset for easier configuration + -- presets = { + -- bottom_search = false, -- use a classic bottom cmdline for search + -- command_palette = true, -- position the cmdline and popupmenu together + -- 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 = true, -- add a border to hover docs and signature help + -- }, + -- }) require 'FTerm'.setup({ border = 'double', @@ -512,6 +480,29 @@ in { local dap = require'dap'; dap.configurations.rust = { rr_dap.get_rust_config() } dap.configurations.cpp = { rr_dap.get_config() } + + require('neoscroll').setup() + do + function setup() + local capabilities = vim.lsp.protocol.make_client_capabilities() + capabilities.textDocument.foldingRange = { + dynamicRegistration = false, + lineFoldingOnly = true + } + local language_servers = require("lspconfig").util.available_servers() -- or list servers manually like {'gopls', 'clangd'} + for _, ls in ipairs(language_servers) do + require('lspconfig')[ls].setup({ + capabilities = capabilities + -- you can add other fields for setting up lsp server in this table + }) + end + end + success, output = pcall(setup) + if not success then + print("Failed to setup lspconfig folds: " .. output) + end + end + require('ufo').setup() ''; package = pkgs.neovim-nightly; }; diff --git a/flake.lock b/flake.lock index 82994a00..a6a9cc88 100644 --- a/flake.lock +++ b/flake.lock @@ -390,11 +390,11 @@ ] }, "locked": { - "lastModified": 1701473968, - "narHash": "sha256-YcVE5emp1qQ8ieHUnxt1wCZCC3ZfAS+SRRWZ2TMda7E=", + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "34fed993f1674c8d06d58b37ce1e0fe5eebcb9f5", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", "type": "github" }, "original": { @@ -517,11 +517,11 @@ "systems": "systems_6" }, "locked": { - "lastModified": 1709126324, - "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -655,11 +655,11 @@ ] }, "locked": { - "lastModified": 1708547820, - "narHash": "sha256-xU/KC1PWqq5zL9dQ9wYhcdgxAwdeF/dJCLPH3PNZEBg=", + "lastModified": 1710478346, + "narHash": "sha256-Xjf8BdnQG0tLhPMlqQdwCIjOp7Teox0DP3N/jjyiGM4=", "owner": "hercules-ci", "repo": "hercules-ci-effects", - "rev": "0ca27bd58e4d5be3135a4bef66b582e57abe8f4a", + "rev": "64e7763d72c1e4c1e5e6472640615b6ae2d40fbf", "type": "github" }, "original": { @@ -675,11 +675,11 @@ ] }, "locked": { - "lastModified": 1710273215, - "narHash": "sha256-AfVYEQIhOK6vaYVndgqFV4Vb5REXG9R0ylv83QInsT0=", + "lastModified": 1710974515, + "narHash": "sha256-jZpdsypecYTOO9l12Vy77otGmh9uz8tGzcguifA30Vs=", "owner": "nix-community", "repo": "home-manager", - "rev": "a500de54b2e3067201a40cefa5f210f719423ddf", + "rev": "1c2acec99933f9835cc7ad47e35303de92d923a4", "type": "github" }, "original": { @@ -739,11 +739,11 @@ "systems": "systems_4" }, "locked": { - "lastModified": 1710863423, - "narHash": "sha256-JdSC7TCqPOp85B9jpAAlkVrIVejJFY+f9rSlDc9vKsk=", + "lastModified": 1711101603, + "narHash": "sha256-5/uA1LoIQ6BhvABbTy46w97vO+q5jcngZ4BOsJtKiXs=", "owner": "hyprwm", "repo": "hyprlock", - "rev": "54da0cae0f197f07c17c672ebdc22de244859494", + "rev": "0db5afb9d618571048bc30958e10b1990130bbb4", "type": "github" }, "original": { @@ -762,11 +762,11 @@ "rust-overlay": "rust-overlay_3" }, "locked": { - "lastModified": 1710170683, - "narHash": "sha256-ya+kRZ/37f0fdR+9BegJlx7TL6PxXzc4Vd52jf5xvSs=", + "lastModified": 1710805279, + "narHash": "sha256-C+ebLZsk+R9402NUZpcPFjGUo73+ut2EDrWGMkp41R4=", "owner": "JakeStanger", "repo": "ironbar", - "rev": "18ee921fab20578f08b229d0fdbe72db02d45927", + "rev": "82546275959970b1dad409c03f8ad3a29e95243a", "type": "github" }, "original": { @@ -788,11 +788,11 @@ "rust-overlay": "rust-overlay_4" }, "locked": { - "lastModified": 1710171982, - "narHash": "sha256-WFMB+Yohcvego1/vOtaq+MJ8Wvp5meOANfNifg26Ie4=", + "lastModified": 1710837180, + "narHash": "sha256-WVkLclGrUliLJUl+XaJplo09VdxyqHxZtkEmmDW2QYY=", "owner": "nix-community", "repo": "lanzaboote", - "rev": "19ad7fd5724f30868748b8156ff25be838cd2bc5", + "rev": "ded8d23709f94aedb1407bee9e26581f258e9e3a", "type": "github" }, "original": { @@ -853,11 +853,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1710199222, - "narHash": "sha256-iZ8v1gkzUVVI9t5BKHAxRHgMpUjJq/yJgB7VyCUMTag=", + "lastModified": 1711063903, + "narHash": "sha256-O0xgUE0BPHiVVoHm/WnRBZMCW5qJSuqPZZhVqF6uZv8=", "owner": "neovim", "repo": "neovim", - "rev": "b02a4d8ac39bafdbfd490bfbab35e3202e6f709c", + "rev": "15c6909bb198ca8a1a22405a4a7e96357716e57e", "type": "github" }, "original": { @@ -878,11 +878,11 @@ ] }, "locked": { - "lastModified": 1710201806, - "narHash": "sha256-ySFpQv1cVsm1uGr/cbtfvWht6Kszfy/aP3TjiLQ8h0w=", + "lastModified": 1711065810, + "narHash": "sha256-QasZbe7PZF/e0i3SAKhKoF6LCXJ2QdtAgbFAdpYCrFA=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "a6185e08ac09b6528b7120cd2886610eaffd68de", + "rev": "278fc96760142b5e569636776344f3af16e281ee", "type": "github" }, "original": { @@ -937,11 +937,11 @@ "nixpkgs": "nixpkgs_4" }, "locked": { - "lastModified": 1710120787, - "narHash": "sha256-tlLuB73OCOKtU2j83bQzSYFyzjJo3rjpITZE5MoofG8=", + "lastModified": 1710644923, + "narHash": "sha256-0fjbN5GYYDKPyPay0l8gYoH+tFfNqPPwP5sxxBreeA4=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "e76ff2df6bfd2abe06abd8e7b9f217df941c1b07", + "rev": "e25efda85e39fcdc845e371971ac4384989c4295", "type": "github" }, "original": { @@ -986,11 +986,11 @@ }, "nixpkgs-main": { "locked": { - "lastModified": 1711054707, - "narHash": "sha256-DSww15yQ7ICWZ/B7Bm+mZkURoYBTtF9UEAmwea1Je2w=", + "lastModified": 1711115889, + "narHash": "sha256-zkQXlAyua4x+LWyxqd8Giq7i6MzOdr9fQYCiNP5AZno=", "owner": "nixos", "repo": "nixpkgs", - "rev": "38d8d0e7ea26033834f8e1138bdeaaa952c6f77b", + "rev": "f5d01c67cfeb71c1c6f0972a6828f206061b7678", "type": "github" }, "original": { @@ -1047,11 +1047,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1709703039, - "narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=", + "lastModified": 1710451336, + "narHash": "sha256-pP86Pcfu3BrAvRO7R64x7hs+GaQrjFes+mEPowCfkxY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d", + "rev": "d691274a972b3165335d261cc4671335f5c67de9", "type": "github" }, "original": { @@ -1063,11 +1063,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1710806803, - "narHash": "sha256-qrxvLS888pNJFwJdK+hf1wpRCSQcqA6W5+Ox202NDa0=", + "lastModified": 1711001935, + "narHash": "sha256-URtGpHue7HHZK0mrHnSf8wJ6OmMKYSsoLmJybrOLFSQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b06025f1533a1e07b6db3e75151caa155d1c7eb3", + "rev": "20f77aa09916374aa3141cbc605c955626762c9a", "type": "github" }, "original": { @@ -1090,11 +1090,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1710936779, - "narHash": "sha256-ecYnUzSWqRae10pp7J6ZE2BznTPJ9f8sLiIoDBQtRBw=", + "lastModified": 1711109741, + "narHash": "sha256-QGjyabkJSkKP/RCs11xuVUj/j1wYLLtVRoNB/uGlAvY=", "owner": "nix-community", "repo": "nixvim", - "rev": "4f6e90212c7ec56d7c03611fb86befa313e7f61f", + "rev": "848543d527cdaa3d708dbb69db94dd8e91859ab1", "type": "github" }, "original": { @@ -1105,11 +1105,11 @@ }, "nur": { "locked": { - "lastModified": 1710276687, - "narHash": "sha256-S53VF0PA1pTz87oi3NKID7BnOqUFrKOflLXA/9DL46M=", + "lastModified": 1711114923, + "narHash": "sha256-fX5g4ZNlTNGSW6dzUkfzKCQTacIVgLGAovhsA3nbRPs=", "owner": "nix-community", "repo": "nur", - "rev": "b221a8e8493458bf33a754d86970bc656fdc43cc", + "rev": "058c918315ecbc64295046d2e81227be92ea9595", "type": "github" }, "original": { @@ -1270,11 +1270,11 @@ ] }, "locked": { - "lastModified": 1710036830, - "narHash": "sha256-pnV4gO3N/7/GzyRSKTRlSfS/19KJiPSvYcL4apnSkoQ=", + "lastModified": 1710641527, + "narHash": "sha256-R9JZEevtSyg7++LEryYJRrfyEe45azJxmu2k9VezEW0=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "d09dac6a63a2ac4b74ac2ecdc19acd8c46c2da2c", + "rev": "50db54295d3922a3b7a40d580b84d75150b36c34", "type": "github" }, "original": { diff --git a/overlays.nix b/overlays.nix index 1df8e453..4d206d9b 100644 --- a/overlays.nix +++ b/overlays.nix @@ -215,23 +215,30 @@ rest-nvim-src = final.pkgs.fetchFromGitHub { owner = "rest-nvim"; repo = "rest.nvim"; - rev = "v2.0.0"; + rev = "9023802373bfcef55cd4907ac3135e0737aa337b"; # sha256 = "sha256-3EC0j/hEbdQ8nJU0I+LGmE/zNnglO/FrP/6POer0338"; # sha256 = "sha256-3EC0j/hEbdQ8nJU0I+LGmE/zNnglO/FrP/6POer0339"; - sha256 = "sha256-d/2aiQZ4YpZ//j6N4boU5ASVFJcErwpK/9PCisEXoxg="; + sha256 = "sha256-CyJyeODZbfWDAvSzzqrAEcFmLASxu3GBdF5VxSocwbY"; }; in { vimPlugins = prev.vimPlugins // { rest-nvim = final.neovimUtils.buildNeovimPlugin { + pname = "rest.nvim"; + version = "scm-1"; + # src = rest-nvim-src; + # buildInputs = with final.pkgs.lua51Packages; [lua lua-curl mimetypes nvim-nio xml2lua]; + }; + }; + lua51Packages = + prev.lua51Packages + // { + rest-nvim = final.lua.buildLuarocksPackage { pname = "rest.nvim"; version = "scm-1"; src = rest-nvim-src; - postInstall = '' - mkdir -p $out/ - cp -r ftplugin ftdetect syntax $out/ - ''; + buildInputs = with final.lua51Packages; [lua lua-curl mimetypes nvim-nio xml2lua]; }; }; }; @@ -245,8 +252,8 @@ in [ shell-scipts misc-applications inputs.neovim-nightly-overlay.overlay + inputs.nur.overlay + # rest-nvim-overlay # inputs.rustaceanvim.overlays.default # inputs.nixneovim.overlays.default - inputs.nur.overlay - rest-nvim-overlay ]