From bbf294cceb58182333faf0c62b57f0f5dece46e9 Mon Sep 17 00:00:00 2001
From: Eelco Dolstra <eelco.dolstra@logicblox.com>
Date: Tue, 4 Nov 2014 10:14:18 +0100
Subject: [PATCH] Add a launchd configuration file to run nix-daemon

---
 Makefile                                   |  1 +
 misc/launchd/local.mk                      |  5 +++++
 misc/launchd/org.nixos.nix-daemon.plist.in | 16 ++++++++++++++++
 3 files changed, 22 insertions(+)
 create mode 100644 misc/launchd/local.mk
 create mode 100644 misc/launchd/org.nixos.nix-daemon.plist.in

diff --git a/Makefile b/Makefile
index b41a82027..08e4012f9 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,7 @@ makefiles = \
   scripts/local.mk \
   corepkgs/local.mk \
   misc/systemd/local.mk \
+  misc/launchd/local.mk \
   misc/upstart/local.mk \
   misc/emacs/local.mk \
   doc/manual/local.mk \
diff --git a/misc/launchd/local.mk b/misc/launchd/local.mk
new file mode 100644
index 000000000..0ba722efb
--- /dev/null
+++ b/misc/launchd/local.mk
@@ -0,0 +1,5 @@
+ifeq ($(OS), Darwin)
+
+  $(eval $(call install-data-in, $(d)/org.nixos.nix-daemon.plist, $(prefix)/Library/LaunchDaemons))
+
+endif
diff --git a/misc/launchd/org.nixos.nix-daemon.plist.in b/misc/launchd/org.nixos.nix-daemon.plist.in
new file mode 100644
index 000000000..2e76947ea
--- /dev/null
+++ b/misc/launchd/org.nixos.nix-daemon.plist.in
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+  <dict>
+    <key>Label</key>
+    <string>org.nixos.nix-daemon</string>
+    <key>RunAtLoad</key>
+    <true/>
+    <key>Program</key>
+    <string>@bindir@/nix-daemon</string>
+    <key>StandardErrorPath</key>
+    <string>/var/log/nix-daemin.log</string>
+    <key>StandardOutPath</key>
+    <string>/dev/null</string>
+  </dict>
+</plist>
-- 
GitLab