modules/fn: use content instead of settings

move content to content.extra
This commit is contained in:
Dmitriy Pleshevskiy 2024-05-01 02:01:47 +03:00
parent 238e4bf68e
commit 688e8e2ece
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
2 changed files with 9 additions and 7 deletions

View file

@ -9,12 +9,14 @@ let
default = [ ]; default = [ ];
}; };
content = mkOption { content = mkOption {
type = types.functionTo (lib.types.submoduleWith {
modules = [
{
options.extra = with lib; mkOption {
type = with types; nullOr attrs; type = with types; nullOr attrs;
default = null; default = null;
}; };
settings = mkOption { }
type = types.functionTo (lib.types.submoduleWith {
modules = [
./vim/keymap.nix ./vim/keymap.nix
# ./vim/opts.nix # ./vim/opts.nix
]; ];
@ -34,10 +36,10 @@ let
lambda = with lib.nix2lua; lambda = with lib.nix2lua;
let let
fnArgs = builtins.listToAttrs (map (v: { name = v; value = raw v; }) config.args); fnArgs = builtins.listToAttrs (map (v: { name = v; value = raw v; }) config.args);
innerCfg = config.settings fnArgs; innerCfg = config.content fnArgs;
in in
lambda config.args (lib.flatten [ lambda config.args (lib.flatten [
config.content innerCfg.extra
(lib.flip map innerCfg.vim.keymap.set ({ mode, lhs, rhs, ... } @ vars: (lib.flip map innerCfg.vim.keymap.set ({ mode, lhs, rhs, ... } @ vars:
let let

View file

@ -21,7 +21,7 @@ let cfg = config.plugins.gitsigns; in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
fn.gitsigns-nvim-on-attach = { fn.gitsigns-nvim-on-attach = {
args = [ "bufnr" ]; args = [ "bufnr" ];
settings = { bufnr }: { content = { bufnr }: {
vim.keymap.set = map (attrs: attrs // { buffer = bufnr; }) cfg.keymap.set; vim.keymap.set = map (attrs: attrs // { buffer = bufnr; }) cfg.keymap.set;
}; };
}; };