From 640e37bd0803636cf0f3bfea403764c6332a277b Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Thu, 4 May 2023 18:41:11 +0300 Subject: [PATCH] dev: init nvim-dap setup --- extra.nix | 8 ++++++ flake.lock | 34 ++++++++++++++++++++++++++ flake.nix | 11 +++++++++ lib/types/plugins.nix | 2 ++ modules/debugger/default.nix | 5 ++++ modules/debugger/nvim-dap/config.nix | 23 +++++++++++++++++ modules/debugger/nvim-dap/default.nix | 6 +++++ modules/debugger/nvim-dap/nvim-dap.nix | 10 ++++++++ modules/modules.nix | 1 + 9 files changed, 100 insertions(+) create mode 100644 modules/debugger/default.nix create mode 100644 modules/debugger/nvim-dap/config.nix create mode 100644 modules/debugger/nvim-dap/default.nix create mode 100644 modules/debugger/nvim-dap/nvim-dap.nix diff --git a/extra.nix b/extra.nix index 70ccbfb..a38a2da 100644 --- a/extra.nix +++ b/extra.nix @@ -39,6 +39,13 @@ inputs: let lspSignature.enable = true; }; + vim.debugger = { + nvim-dap = { + enable = true; + ui.enable = true; + }; + }; + vim.languages = { enableLSP = true; enableFormat = true; @@ -217,6 +224,7 @@ inputs: let image_text = "The Superior Text Editor"; client_id = "793271441293967371"; main_image = "neovim"; + show_time = true; rich_presence = { editing_text = "Editing %s"; }; diff --git a/flake.lock b/flake.lock index f2b194b..bdde15f 100644 --- a/flake.lock +++ b/flake.lock @@ -1012,6 +1012,38 @@ "type": "github" } }, + "nvim-dap": { + "flake": false, + "locked": { + "lastModified": 1682077642, + "narHash": "sha256-l5sJ6PKW10CtOzSBKzWasWVMZq/mAkgpgWOecIVuV+0=", + "owner": "mfussenegger", + "repo": "nvim-dap", + "rev": "6cedcb527e264c8f25e86afa8dae74c6692dee51", + "type": "github" + }, + "original": { + "owner": "mfussenegger", + "repo": "nvim-dap", + "type": "github" + } + }, + "nvim-dap-ui": { + "flake": false, + "locked": { + "lastModified": 1683055722, + "narHash": "sha256-8TavZqkTCr2/jaO3C8fp+r7qfN6mCzVvidbHGtJGLfs=", + "owner": "rcarriga", + "repo": "nvim-dap-ui", + "rev": "749bfe12d1447703899fa823c1c075fbe2d42c24", + "type": "github" + }, + "original": { + "owner": "rcarriga", + "repo": "nvim-dap-ui", + "type": "github" + } + }, "nvim-lightbulb": { "flake": false, "locked": { @@ -1360,6 +1392,8 @@ "nvim-colorizer-lua": "nvim-colorizer-lua", "nvim-compe": "nvim-compe", "nvim-cursorline": "nvim-cursorline", + "nvim-dap": "nvim-dap", + "nvim-dap-ui": "nvim-dap-ui", "nvim-lightbulb": "nvim-lightbulb", "nvim-lspconfig": "nvim-lspconfig", "nvim-neoclip": "nvim-neoclip", diff --git a/flake.nix b/flake.nix index 0198f1e..61aa9c3 100644 --- a/flake.nix +++ b/flake.nix @@ -162,6 +162,17 @@ inputs.flake-utils.follows = "flake-utils"; }; + # Debuggers + nvim-dap = { + url = "github:mfussenegger/nvim-dap"; + flake = false; + }; + + nvim-dap-ui = { + url = "github:rcarriga/nvim-dap-ui"; + flake = false; + }; + # Filetrees nvim-tree-lua = { url = "github:nvim-tree/nvim-tree.lua"; diff --git a/lib/types/plugins.nix b/lib/types/plugins.nix index 9515b04..111fd8c 100644 --- a/lib/types/plugins.nix +++ b/lib/types/plugins.nix @@ -85,6 +85,8 @@ with lib; let "nvim-colorizer-lua" "vim-illuminate" "nvim-surround" + "nvim-dap" + "nvim-dap-ui" ]; # You can either use the name of the plugin or a package. pluginsType = with types; diff --git a/modules/debugger/default.nix b/modules/debugger/default.nix new file mode 100644 index 0000000..f882196 --- /dev/null +++ b/modules/debugger/default.nix @@ -0,0 +1,5 @@ +_: { + imports = [ + ./nvim-dap + ]; +} diff --git a/modules/debugger/nvim-dap/config.nix b/modules/debugger/nvim-dap/config.nix new file mode 100644 index 0000000..60d8a92 --- /dev/null +++ b/modules/debugger/nvim-dap/config.nix @@ -0,0 +1,23 @@ +{ + config, + lib, + ... +}: +with lib; +with builtins; let + cfg = config.vim.debugger.nvim-dap; +in { + config = mkIf cfg.enable { + vim.startPlugins = + [ + "nvim-dap" + ] + ++ optionals cfg.ui.enable [ + "nvim-dap-ui" + ]; + + vim.luaConfigRC.nvim-dap-ui = nvim.dag.entryAnywhere '' + require("dapui").setup() + ''; + }; +} diff --git a/modules/debugger/nvim-dap/default.nix b/modules/debugger/nvim-dap/default.nix new file mode 100644 index 0000000..083220b --- /dev/null +++ b/modules/debugger/nvim-dap/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./config.nix + ./nvim-dap.nix + ]; +} diff --git a/modules/debugger/nvim-dap/nvim-dap.nix b/modules/debugger/nvim-dap/nvim-dap.nix new file mode 100644 index 0000000..14eb359 --- /dev/null +++ b/modules/debugger/nvim-dap/nvim-dap.nix @@ -0,0 +1,10 @@ +{lib, ...}: +with lib; { + options.vim.debugger.nvim-dap = { + enable = mkEnableOption "Enable debugging via nvim-dap"; + + ui = { + enable = mkEnableOption "Enable UI extension for nvim-dap"; + }; + }; +} diff --git a/modules/modules.nix b/modules/modules.nix index a23241c..b3cb152 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -29,6 +29,7 @@ ./comments ./projects ./languages + ./debugger ]; pkgsModule = {config, ...}: {