feat(lib): lua namespace for conversion helpers

This commit is contained in:
NotAShelf 2023-04-18 02:01:45 +03:00
parent 58f7d8b62e
commit 8658ea13a2
No known key found for this signature in database
GPG key ID: F0D14CCB5ED5AA22
4 changed files with 14 additions and 9 deletions

View file

@ -1,9 +0,0 @@
# From home-manager: https://github.com/nix-community/home-manager/blob/master/modules/lib/booleans.nix
{lib}: {
# Converts a boolean to a yes/no string. This is used in lots of
# configuration formats.
yesNo = value:
if value
then "yes"
else "no";
}

View file

@ -4,4 +4,5 @@
types = import ./types {inherit lib;};
languages = import ./languages.nix {inherit lib;};
nmd = import ./nmd.nix;
lua = import ./lua.nix {inherit lib;};
}

12
lib/lua.nix Normal file
View file

@ -0,0 +1,12 @@
# Helpers for converting values to lua
{lib}: {
yesNo = value:
if value
then "yes"
else "no";
nullString = value:
if value == null
then "nil"
else "'${value}'";
}

View file

@ -41,6 +41,7 @@ with lib; let
"rust-tools"
"onedark"
"catppuccin"
"dracula"
"minimap-vim"
"dashboard-nvim"
"alpha-nvim"