From 86d91dbac5f1bce8f90d0e2e57b8c6022a2f8761 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;