feat: implement freeform smartcolumn column positions

This commit is contained in:
NotAShelf 2023-06-04 14:12:08 +03:00
commit 2cfeb22764
No known key found for this signature in database
GPG key ID: F0D14CCB5ED5AA22
5 changed files with 48 additions and 38 deletions

View file

@ -1,12 +1,32 @@
# Helpers for converting values to lua
{lib}: {
{lib}: rec {
# yes? no.
yesNo = value:
if value
then "yes"
else "no";
# Convert a null value to lua's nil
nullString = value:
if value == null
then "nil"
else "'${value}'";
# Helper function to convert an attribute name to a Lua table key
attrToKey = name: name;
# Function to convert a Nix attrset to a Lua table
attrsetToLuaTable = attrset:
"{ "
+ (
builtins.concatStringsSep ", "
(builtins.attrValues (
builtins.mapAttrs (
name: value:
attrToKey name + " = " + ("\"" + builtins.toJSON value + "\"")
)
attrset
))
)
+ " }";
}