8.nix-darwin/modules/launchd/lib.nix
2016-11-01 22:54:20 +01:00

28 lines
482 B
Nix

{ lib }:
with lib;
rec {
xmlMap = f: xs: ''
<array>
${concatMapStringsSep "\n" f xs}
</array>
'';
xmlMapAttrs = f: attr: ''
<dict>
${concatStringsSep "\n" (mapAttrsFlatten (xmlMapAttr f) attr)}
</dict>
'';
xmlMapAttr = f: n: v: optionalString (v != null) ''
<key>${n}</key>
${f v}
'';
xmlBool = x: if x then "<true/>" else "<false/>";
xmlInt = x: "<integer>${toString x}</integer>";
xmlString = x: "<string>${x}</string>";
}