Skip to content

Commit

Permalink
wip toml
Browse files Browse the repository at this point in the history
  • Loading branch information
mkg20001 committed Feb 3, 2025
1 parent 571e5bd commit 1bd3c1d
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions toTOML.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
let
toTOMLInner = { data, path }:
if builtins.isAttrs data then
builtins.concatMap iter (builtins.attrNames set)
else if builtins.isFloat then
builtins.toString data
else if builtins.isInt then
builtins.toString data
else if builtins.isNull then
"null"
else if builtins.isString then
data # TODO: escape
else if builtins.isBool then
if data then "true" else "false"
else if builtins.isFunction then
builtins.throw "Can't convert a function to a string"
else if builtins.isList then
else if builtins.isPath then
builtins.toString data # TODO: escape
else builtins.throw "Not any valid data-type";

toTOML = data:
if builtins.isAttrs data then
toTOMLInner { inherit data; path = []; }
else
builtins.throw "Must be of type attrs";
in
{
testData = {
sub = {
sub2 = {
e = true;
};
};

e = true;
};
}

0 comments on commit 1bd3c1d

Please sign in to comment.