mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-04-09 03:56:11 +00:00
wrapper/lib: init with mkMappingOption
mkMappingOption wants to read a setting set in config without passing it every time, so it should be defined in config.
This commit is contained in:
parent
3ffc800a01
commit
8b5ef2cf08
5 changed files with 41 additions and 1 deletions
|
|
@ -57,6 +57,7 @@
|
||||||
"rc"
|
"rc"
|
||||||
"warnings"
|
"warnings"
|
||||||
"lazy"
|
"lazy"
|
||||||
|
"lib"
|
||||||
];
|
];
|
||||||
|
|
||||||
# Extra modules, such as deprecation warnings
|
# Extra modules, such as deprecation warnings
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{lib, ...}: let
|
{lib, ...}: let
|
||||||
inherit (lib.options) mkOption literalMD;
|
inherit (lib.options) mkEnableOption mkOption literalMD;
|
||||||
inherit (lib.types) either str listOf attrsOf nullOr submodule;
|
inherit (lib.types) either str listOf attrsOf nullOr submodule;
|
||||||
inherit (lib.nvim.config) mkBool;
|
inherit (lib.nvim.config) mkBool;
|
||||||
|
|
||||||
|
|
@ -57,6 +57,8 @@
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
options.vim = {
|
options.vim = {
|
||||||
|
vendoredKeymaps = mkEnableOption "this project's vendored keymaps by default" // {default = true;};
|
||||||
|
|
||||||
keymaps = mkOption {
|
keymaps = mkOption {
|
||||||
type = listOf mapType;
|
type = listOf mapType;
|
||||||
description = "Custom keybindings.";
|
description = "Custom keybindings.";
|
||||||
|
|
|
||||||
20
modules/wrapper/lib/config.nix
Normal file
20
modules/wrapper/lib/config.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit (lib.options) mkOption;
|
||||||
|
inherit (lib.types) nullOr str;
|
||||||
|
in {
|
||||||
|
config.vim.lib = {
|
||||||
|
mkMappingOption = description: default:
|
||||||
|
mkOption {
|
||||||
|
type = nullOr str;
|
||||||
|
default =
|
||||||
|
if config.vim.vendoredKeymaps
|
||||||
|
then default
|
||||||
|
else null;
|
||||||
|
inherit description;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/wrapper/lib/default.nix
Normal file
6
modules/wrapper/lib/default.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config.nix
|
||||||
|
./options.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
11
modules/wrapper/lib/options.nix
Normal file
11
modules/wrapper/lib/options.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
{lib, ...}: let
|
||||||
|
inherit (lib.options) mkOption;
|
||||||
|
inherit (lib.types) attrsOf raw;
|
||||||
|
in {
|
||||||
|
options.vim.lib = mkOption {
|
||||||
|
# The second type should be one without merge semantics and which allows function values.
|
||||||
|
type = attrsOf raw;
|
||||||
|
default = {};
|
||||||
|
internal = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue