From 2d9b24dfdb6f258159b203bc4f79f1015fd25cf0 Mon Sep 17 00:00:00 2001 From: n3oney Date: Tue, 11 Apr 2023 14:38:08 +0200 Subject: [PATCH] feat: add lib function to quickly mkIf bindings --- lib/stdlib-extended.nix | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/stdlib-extended.nix b/lib/stdlib-extended.nix index f43bc15..8a9fdb4 100644 --- a/lib/stdlib-extended.nix +++ b/lib/stdlib-extended.nix @@ -7,6 +7,23 @@ in nixpkgsLib.extend (self: super: { nvim = mkNvimLib {lib = self;}; + mkLuaBinding = key: action: desc: + self.mkIf (key != null) { + "${key}" = { + inherit action desc; + lua = true; + silent = true; + }; + }; + + mkBinding = key: action: desc: + self.mkIf (key != null) { + "${key}" = { + inherit action desc; + silent = true; + }; + }; + # For forward compatibility. literalExpression = super.literalExpression or super.literalExample; literalDocBook = super.literalDocBook or super.literalExample;