summaryrefslogtreecommitdiff
path: root/lib/lua.nix
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-06-24 11:51:39 -0400
committerFreya Murphy <freya@freyacat.org>2025-06-24 11:51:39 -0400
commitd639c293ad1ba71008aeb5c54c40f59a076018dc (patch)
treee832a3f0ee5044c8b35e5642f07a62137bbffc2c /lib/lua.nix
parentupdate ssh config (diff)
downloaddotfiles-nix-d639c293ad1ba71008aeb5c54c40f59a076018dc.tar.gz
dotfiles-nix-d639c293ad1ba71008aeb5c54c40f59a076018dc.tar.bz2
dotfiles-nix-d639c293ad1ba71008aeb5c54c40f59a076018dc.zip
redo lib, make global vars for key lists
Diffstat (limited to 'lib/lua.nix')
-rw-r--r--lib/lua.nix10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/lua.nix b/lib/lua.nix
index 704cdfa..6f6389e 100644
--- a/lib/lua.nix
+++ b/lib/lua.nix
@@ -1,6 +1,6 @@
{lib, ...}: let
- fmt = val:
- # nil
+ toLua = val:
+ # nil
if val == null
then "nil"
# boolean
@@ -17,16 +17,16 @@
then "'${val}'"
# table (array)
else if builtins.isList val
- then "{ " + (lib.concatStringsSep ", " (map fmt val)) + " }"
+ then "{ " + (lib.concatStringsSep ", " (map toLua val)) + " }"
# table (object)
else if builtins.isAttrs val
then
"{ "
+ (lib.concatStringsSep ", "
- (lib.mapAttrsToList (k: v: "${k} = ${fmt v}") val))
+ (lib.mapAttrsToList (k: v: "${k} = ${toLua v}") val))
+ " }"
# invalid
else throw "Unsupported value: ${toString val}";
in {
- fmt = fmt;
+ inherit toLua;
}