lib.toPlist: support for path values

This commit is contained in:
Emil "AngryAnt" Johansen 2023-03-27 15:46:32 +02:00
parent a1c45f32e6
commit 03ceb367b7
No known key found for this signature in database
GPG Key ID: 0C6DFE2FB234534A

View File

@ -355,6 +355,7 @@ rec {
# PLIST handling # PLIST handling
toPlist = {}: v: let toPlist = {}: v: let
isFloat = builtins.isFloat or (x: false); isFloat = builtins.isFloat or (x: false);
isPath = x: builtins.typeOf x == "path";
expr = ind: x: with builtins; expr = ind: x: with builtins;
if x == null then "" else if x == null then "" else
if isBool x then bool ind x else if isBool x then bool ind x else
@ -362,6 +363,7 @@ rec {
if isString x then str ind x else if isString x then str ind x else
if isList x then list ind x else if isList x then list ind x else
if isAttrs x then attrs ind x else if isAttrs x then attrs ind x else
if isPath x then str ind (toString x) else
if isFloat x then float ind x else if isFloat x then float ind x else
abort "generators.toPlist: should never happen (v = ${v})"; abort "generators.toPlist: should never happen (v = ${v})";