Cleanup
This commit is contained in:
parent
a38d907959
commit
6cc5211c9c
1 changed files with 17 additions and 14 deletions
|
@ -63,20 +63,23 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
repeat = count: char: lib.strings.concatStrings (builtins.genList (_: char) count);
|
toRecursiveINI = with lib.strings; with lib.attrsets; with lib.generators; with lib.lists; let
|
||||||
mkHeader = depth: name: lib.strings.concatStrings [ (repeat depth "[") name (repeat depth "]") ];
|
repeat = count: char: concatStrings (genList (_: char) count);
|
||||||
simpleAttrs = lib.attrsets.filterAttrs (n: v: !(builtins.isAttrs v));
|
mkHeader = depth: name: concatStrings [ (repeat depth "[") (escape [ "[" ] name) (repeat depth "]") ];
|
||||||
complexAttrs = lib.attrsets.filterAttrs (n: v: builtins.isAttrs v);
|
simpleAttrs = filterAttrs (n: v: !(isAttrs v));
|
||||||
toRecursiveINIBase = depth: data: (builtins.concatStringsSep "\n" (
|
complexAttrs = filterAttrs (n: v: isAttrs v);
|
||||||
lib.attrsets.mapAttrsToList
|
removeEmpty = filter (v: v != "");
|
||||||
(name: values: builtins.concatStringsSep "\n" (builtins.filter (v: v != "") [
|
toRecursiveINIBase = depth: data: (concatStringsSep "\n" (
|
||||||
(mkHeader depth name)
|
mapAttrsToList
|
||||||
(lib.generators.toKeyValue { } (simpleAttrs values))
|
(name: values: concatStringsSep "\n" (removeEmpty [
|
||||||
(toRecursiveINIBase (depth + 1) (complexAttrs values))
|
(mkHeader depth name)
|
||||||
]))
|
(toKeyValue { } (simpleAttrs values))
|
||||||
data
|
(toRecursiveINIBase (depth + 1) (complexAttrs values))
|
||||||
));
|
]))
|
||||||
toRecursiveINI = toRecursiveINIBase 1;
|
data
|
||||||
|
));
|
||||||
|
in
|
||||||
|
toRecursiveINIBase 1;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
custom.zfs.homeLinks = [
|
custom.zfs.homeLinks = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue