modules: make lib calls explicit where possible

This commit is contained in:
raf 2024-02-26 08:05:23 +03:00
commit 024e1a6845
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29
41 changed files with 245 additions and 203 deletions

View file

@ -1,4 +1,4 @@
_: {
{
imports = [
./nvim-dap
];

View file

@ -3,12 +3,14 @@
lib,
...
}: let
inherit (lib) addDescriptionsToMappings mkMerge mkIf mapAttrs nvim mkSetLuaBinding optionalString;
inherit (lib.strings) optionalString;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.attrsets) mapAttrs;
inherit (lib.nvim.binds) addDescriptionsToMappings mkSetLuaBinding;
inherit (lib.nvim.dag) entryAnywhere entryAfter;
cfg = config.vim.debugger.nvim-dap;
self = import ./nvim-dap.nix {
inherit lib;
};
self = import ./nvim-dap.nix {inherit lib;};
mappingDefinitions = self.options.vim.debugger.nvim-dap.mappings;
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
in {
@ -19,12 +21,12 @@ in {
vim.luaConfigRC =
{
# TODO customizable keymaps
nvim-dap = nvim.dag.entryAnywhere ''
nvim-dap = entryAnywhere ''
local dap = require("dap")
vim.fn.sign_define("DapBreakpoint", { text = "🛑", texthl = "ErrorMsg", linehl = "", numhl = "" })
'';
}
// mapAttrs (_: v: (nvim.dag.entryAfter ["nvim-dap"] v)) cfg.sources;
// mapAttrs (_: v: (entryAfter ["nvim-dap"] v)) cfg.sources;
vim.maps.normal = mkMerge [
(mkSetLuaBinding mappings.continue "require('dap').continue")
@ -49,7 +51,7 @@ in {
(mkIf (cfg.enable && cfg.ui.enable) {
vim.startPlugins = ["nvim-dap-ui"];
vim.luaConfigRC.nvim-dap-ui = nvim.dag.entryAfter ["nvim-dap"] (''
vim.luaConfigRC.nvim-dap-ui = entryAfter ["nvim-dap"] (''
local dapui = require("dapui")
dapui.setup()
''

View file

@ -1,4 +1,4 @@
_: {
{
imports = [
./config.nix
./nvim-dap.nix

View file

@ -1,5 +1,7 @@
{lib, ...}: let
inherit (lib) mkEnableOption mkOption types mkMappingOption;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) bool attrsOf str;
inherit (lib.nvim.binds) mkMappingOption;
in {
options.vim.debugger.nvim-dap = {
enable = mkEnableOption "debugging via nvim-dap";
@ -7,7 +9,7 @@ in {
ui = {
enable = mkEnableOption "UI extension for nvim-dap";
autoStart = mkOption {
type = types.bool;
type = bool;
default = true;
description = "Automatically Opens and Closes DAP-UI upon starting/closing a debugging session";
};
@ -16,7 +18,7 @@ in {
sources = mkOption {
default = {};
description = "List of debuggers to install";
type = with types; attrsOf str;
type = attrsOf str;
};
mappings = {