|
1 | 1 | {
|
2 | 2 | lib,
|
3 |
| - config, |
4 |
| - pkgs, |
5 | 3 | ...
|
6 | 4 | }:
|
7 | 5 | let
|
8 | 6 | inherit (lib)
|
9 |
| - mkEnableOption |
10 | 7 | mkOption
|
11 |
| - optionalString |
12 | 8 | types
|
13 | 9 | ;
|
14 | 10 |
|
15 |
| - cfg = config.plugins.dap; |
16 |
| - |
17 | 11 | dapHelpers = import ./dapHelpers.nix { inherit lib; };
|
18 | 12 | inherit (dapHelpers) mkSignOption;
|
19 | 13 | in
|
20 |
| -{ |
| 14 | +lib.nixvim.plugins.mkNeovimPlugin { |
21 | 15 | imports = [
|
22 | 16 | ./dap-go.nix
|
23 | 17 | ./dap-python.nix
|
24 | 18 | ./dap-ui.nix
|
25 | 19 | ./dap-virtual-text.nix
|
26 | 20 | ];
|
27 | 21 |
|
28 |
| - options.plugins.dap = lib.nixvim.plugins.neovim.extraOptionsOptions // { |
29 |
| - enable = mkEnableOption "dap"; |
| 22 | + name = "dap"; |
| 23 | + package = "nvim-dap"; |
| 24 | + packPathName = "nvim-dap"; |
30 | 25 |
|
31 |
| - package = lib.mkPackageOption pkgs "dap" { |
32 |
| - default = [ |
33 |
| - "vimPlugins" |
34 |
| - "nvim-dap" |
35 |
| - ]; |
36 |
| - }; |
| 26 | + maintainers = [ lib.maintainers.khaneliman ]; |
| 27 | + |
| 28 | + # Added 2025-01-26 |
| 29 | + deprecateExtraOptions = true; |
37 | 30 |
|
| 31 | + extraOptions = { |
38 | 32 | adapters = lib.nixvim.mkCompositeOption "Dap adapters." {
|
39 | 33 | executables = dapHelpers.mkAdapterOption "executable" dapHelpers.executableAdapterOption;
|
40 | 34 | servers = dapHelpers.mkAdapterOption "server" dapHelpers.serverAdapterOption;
|
|
43 | 37 | configurations =
|
44 | 38 | lib.nixvim.mkNullOrOption (with types; attrsOf (listOf dapHelpers.configurationOption))
|
45 | 39 | ''
|
46 |
| - Debuggee configurations, see `:h dap-configuration` for more info. |
| 40 | + Debugger configurations, see `:h dap-configuration` for more info. |
47 | 41 | '';
|
48 | 42 |
|
49 | 43 | signs = lib.nixvim.mkCompositeOption "Signs for dap." {
|
|
68 | 62 | };
|
69 | 63 | };
|
70 | 64 |
|
71 |
| - config = |
| 65 | + # Separate configuration and adapter configurations |
| 66 | + callSetup = false; |
| 67 | + extraConfig = |
| 68 | + cfg: |
72 | 69 | let
|
73 |
| - options = |
74 |
| - with cfg; |
75 |
| - { |
76 |
| - inherit configurations; |
77 |
| - |
78 |
| - adapters = |
79 |
| - (lib.optionalAttrs (adapters.executables != null) ( |
80 |
| - dapHelpers.processAdapters "executable" adapters.executables |
81 |
| - )) |
82 |
| - // (lib.optionalAttrs (adapters.servers != null) ( |
83 |
| - dapHelpers.processAdapters "server" adapters.servers |
84 |
| - )); |
85 |
| - |
86 |
| - signs = with signs; { |
87 |
| - DapBreakpoint = dapBreakpoint; |
88 |
| - DapBreakpointCondition = dapBreakpointCondition; |
89 |
| - DapLogPoint = dapLogPoint; |
90 |
| - DapStopped = dapStopped; |
91 |
| - DapBreakpointRejected = dapBreakpointRejected; |
92 |
| - }; |
93 |
| - } |
94 |
| - // cfg.extraOptions; |
| 70 | + options = { |
| 71 | + inherit (cfg) configurations; |
| 72 | + |
| 73 | + adapters = |
| 74 | + (lib.optionalAttrs (cfg.adapters.executables != null) ( |
| 75 | + dapHelpers.processAdapters "executable" cfg.adapters.executables |
| 76 | + )) |
| 77 | + // (lib.optionalAttrs (cfg.adapters.servers != null) ( |
| 78 | + dapHelpers.processAdapters "server" cfg.adapters.servers |
| 79 | + )); |
| 80 | + |
| 81 | + signs = with cfg.signs; { |
| 82 | + DapBreakpoint = dapBreakpoint; |
| 83 | + DapBreakpointCondition = dapBreakpointCondition; |
| 84 | + DapLogPoint = dapLogPoint; |
| 85 | + DapStopped = dapStopped; |
| 86 | + DapBreakpointRejected = dapBreakpointRejected; |
| 87 | + }; |
| 88 | + } // cfg.settings; |
95 | 89 | in
|
96 |
| - lib.mkIf cfg.enable { |
97 |
| - extraPlugins = [ cfg.package ]; |
98 |
| - |
99 |
| - extraConfigLua = |
100 |
| - (optionalString (cfg.adapters != null) '' |
| 90 | + { |
| 91 | + plugins.dap.luaConfig.content = lib.mkMerge [ |
| 92 | + (lib.mkIf (cfg.adapters != null) '' |
101 | 93 | require("dap").adapters = ${lib.nixvim.toLuaObject options.adapters}
|
102 | 94 | '')
|
103 |
| - + (optionalString (options.configurations != null) '' |
| 95 | + (lib.mkIf (options.configurations != null) '' |
104 | 96 | require("dap").configurations = ${lib.nixvim.toLuaObject options.configurations}
|
105 | 97 | '')
|
106 |
| - + (optionalString (cfg.signs != null) '' |
107 |
| - local __dap_signs = ${lib.nixvim.toLuaObject options.signs} |
108 |
| - for sign_name, sign in pairs(__dap_signs) do |
109 |
| - vim.fn.sign_define(sign_name, sign) |
| 98 | + (lib.mkIf (cfg.signs != null) '' |
| 99 | + do |
| 100 | + local __dap_signs = ${lib.nixvim.toLuaObject options.signs} |
| 101 | +
|
| 102 | + for sign_name, sign in pairs(__dap_signs) do |
| 103 | + vim.fn.sign_define(sign_name, sign) |
| 104 | + end |
110 | 105 | end
|
111 | 106 | '')
|
112 |
| - + cfg.extensionConfigLua; |
| 107 | + '' |
| 108 | + ${cfg.extensionConfigLua} |
| 109 | + '' |
| 110 | + ]; |
113 | 111 | };
|
114 | 112 | }
|
0 commit comments