diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2016-11-01 21:25:22 +0100 |
|---|---|---|
| committer | Daiderd Jordan <daiderd@gmail.com> | 2016-11-01 22:54:20 +0100 |
| commit | 5063a360ea9f264ca16941f6b5de6bb34b4e25d7 (patch) | |
| tree | 9c65ba9f0df506cccfcd9610a897e56f65f41e2a /modules/launchd/lib.nix | |
| parent | f86c3e70b05120f1c6d96c461ba40a01dae8cf59 (diff) | |
add launchd module
Diffstat (limited to 'modules/launchd/lib.nix')
| -rw-r--r-- | modules/launchd/lib.nix | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/launchd/lib.nix b/modules/launchd/lib.nix new file mode 100644 index 0000000..483a0d1 --- /dev/null +++ b/modules/launchd/lib.nix @@ -0,0 +1,28 @@ +{ 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>"; + +} |
