Skip to content

Commit e48dda4

Browse files
committed
plugins/dap: remove with lib
1 parent fe2789e commit e48dda4

File tree

6 files changed

+36
-24
lines changed

6 files changed

+36
-24
lines changed

plugins/by-name/dap/dap-go.nix

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
pkgs,
66
...
77
}:
8-
with lib;
98
let
9+
inherit (lib) types;
10+
1011
cfg = config.plugins.dap.extensions.dap-go;
1112
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
1213
in
1314
{
1415
options.plugins.dap.extensions.dap-go = {
15-
enable = mkEnableOption "dap-go";
16+
enable = lib.mkEnableOption "dap-go";
1617

1718
package = lib.mkPackageOption pkgs "dap-go" {
1819
default = [
@@ -55,7 +56,7 @@ in
5556
};
5657
};
5758
in
58-
mkIf cfg.enable {
59+
lib.mkIf cfg.enable {
5960
extraPlugins = [ cfg.package ];
6061

6162
plugins.dap = {

plugins/by-name/dap/dap-python.nix

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
pkgs,
66
...
77
}:
8-
with lib;
98
let
9+
inherit (lib) types;
10+
1011
cfg = config.plugins.dap.extensions.dap-python;
1112
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
1213
in
1314
{
1415
options.plugins.dap.extensions.dap-python = {
15-
enable = mkEnableOption "dap-python";
16+
enable = lib.mkEnableOption "dap-python";
1617

1718
package = lib.mkPackageOption pkgs "dap-python" {
1819
default = [
@@ -21,7 +22,7 @@ in
2122
];
2223
};
2324

24-
adapterPythonPath = mkOption {
25+
adapterPythonPath = lib.mkOption {
2526
default = lib.getExe (pkgs.python3.withPackages (ps: with ps; [ debugpy ]));
2627
defaultText = lib.literalExpression ''
2728
lib.getExe (pkgs.python3.withPackages (ps: with ps; [ debugpy ]))
@@ -67,7 +68,7 @@ in
6768
include_configs = includeConfigs;
6869
};
6970
in
70-
mkIf cfg.enable {
71+
lib.mkIf cfg.enable {
7172
extraPlugins = [ cfg.package ];
7273

7374
plugins.dap = {

plugins/by-name/dap/dap-ui.nix

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
pkgs,
66
...
77
}:
8-
with lib;
98
let
9+
inherit (lib) mkOption types;
10+
1011
cfg = config.plugins.dap.extensions.dap-ui;
1112

1213
mkSizeOption = helpers.mkNullOrOption (with types; either int (numbers.between 0.0 1.0));
1314

1415
mkKeymapOptions =
1516
name:
16-
mapAttrs (
17+
lib.mapAttrs (
1718
key: default:
1819
helpers.defaultNullOpts.mkNullable (
1920
with types; either str (listOf str)
@@ -57,7 +58,7 @@ let
5758
in
5859
{
5960
options.plugins.dap.extensions.dap-ui = lib.nixvim.plugins.neovim.extraOptionsOptions // {
60-
enable = mkEnableOption "dap-ui";
61+
enable = lib.mkEnableOption "dap-ui";
6162

6263
package = lib.mkPackageOption pkgs "dap-ui" {
6364
default = [
@@ -232,7 +233,7 @@ in
232233
}
233234
// cfg.extraOptions;
234235
in
235-
mkIf cfg.enable {
236+
lib.mkIf cfg.enable {
236237
extraPlugins = [ cfg.package ];
237238

238239
plugins.dap = {

plugins/by-name/dap/dap-virtual-text.nix

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
pkgs,
66
...
77
}:
8-
with lib;
98
let
109
cfg = config.plugins.dap.extensions.dap-virtual-text;
1110
in
1211
{
1312
options.plugins.dap.extensions.dap-virtual-text = {
14-
enable = mkEnableOption "dap-virtual-text";
13+
enable = lib.mkEnableOption "dap-virtual-text";
1514

1615
package = lib.mkPackageOption pkgs "dap-virtual-text" {
1716
default = [
@@ -62,7 +61,7 @@ in
6261

6362
virtLines = helpers.defaultNullOpts.mkBool false "Show virtual lines instead of virtual text (will flicker!).";
6463

65-
virtTextWinCol = helpers.mkNullOrOption types.int ''
64+
virtTextWinCol = helpers.mkNullOrOption lib.types.int ''
6665
Position the virtual text at a fixed window column (starting from the first text column).
6766
See `:h nvim_buf_set_extmark()`.
6867
'';
@@ -87,7 +86,7 @@ in
8786
virt_text_win_col = virtTextWinCol;
8887
};
8988
in
90-
mkIf cfg.enable {
89+
lib.mkIf cfg.enable {
9190
extraPlugins = [ cfg.package ];
9291

9392
plugins.dap = {

plugins/by-name/dap/dapHelpers.nix

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{ lib, helpers }:
2-
with lib;
2+
let
3+
inherit (lib) types;
4+
in
35
rec {
46
mkAdapterType =
57
attrs:
@@ -92,12 +94,12 @@ rec {
9294
freeformType = types.attrs;
9395

9496
options = {
95-
type = mkOption {
97+
type = lib.mkOption {
9698
description = "Which debug adapter to use.";
9799
type = types.str;
98100
};
99101

100-
request = mkOption {
102+
request = lib.mkOption {
101103
type = types.enum [
102104
"attach"
103105
"launch"
@@ -107,7 +109,7 @@ rec {
107109
'';
108110
};
109111

110-
name = mkOption {
112+
name = lib.mkOption {
111113
type = types.str;
112114
description = "A user readable name for the configuration.";
113115
};

plugins/by-name/dap/default.nix

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@
55
pkgs,
66
...
77
}:
8-
with lib;
98
let
9+
inherit (lib)
10+
mkAdapterOption
11+
mkEnableOption
12+
mkOption
13+
mkSignOption
14+
optionalString
15+
types
16+
;
17+
1018
cfg = config.plugins.dap;
19+
1120
dapHelpers = import ./dapHelpers.nix { inherit lib helpers; };
1221
in
13-
with dapHelpers;
1422
{
1523
imports = [
1624
./dap-go.nix
@@ -30,8 +38,8 @@ with dapHelpers;
3038
};
3139

3240
adapters = helpers.mkCompositeOption "Dap adapters." {
33-
executables = mkAdapterOption "executable" executableAdapterOption;
34-
servers = mkAdapterOption "server" serverAdapterOption;
41+
executables = mkAdapterOption "executable" dapHelpers.executableAdapterOption;
42+
servers = mkAdapterOption "server" dapHelpers.serverAdapterOption;
3543
};
3644

3745
configurations =
@@ -85,7 +93,7 @@ with dapHelpers;
8593
}
8694
// cfg.extraOptions;
8795
in
88-
mkIf cfg.enable {
96+
lib.mkIf cfg.enable {
8997
extraPlugins = [ cfg.package ];
9098

9199
extraConfigLua =

0 commit comments

Comments
 (0)