about summary refs log tree commit diff
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/systemd/local.mk1
-rw-r--r--misc/systemd/nix-daemon.service10
-rw-r--r--misc/systemd/nix-daemon.service.in9
-rw-r--r--misc/systemd/nix-daemon.socket.in11
4 files changed, 21 insertions, 10 deletions
diff --git a/misc/systemd/local.mk b/misc/systemd/local.mk
new file mode 100644
index 000000000000..a5f6131ce878
--- /dev/null
+++ b/misc/systemd/local.mk
@@ -0,0 +1 @@
+$(foreach n, nix-daemon.socket nix-daemon.service, $(eval $(call install-file-in, $(d)/$(n), $(libdir)/systemd/system, 0644)))
diff --git a/misc/systemd/nix-daemon.service b/misc/systemd/nix-daemon.service
deleted file mode 100644
index ee28209f090e..000000000000
--- a/misc/systemd/nix-daemon.service
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Helper daemon for managing secure, multi-user Nix stores
-After=syslog.target
-
-[Service]
-Type=simple
-ExecStart=/usr/bin/nix-daemon
-
-[Install]
-WantedBy=multi-user.target
diff --git a/misc/systemd/nix-daemon.service.in b/misc/systemd/nix-daemon.service.in
new file mode 100644
index 000000000000..5fc04a3f5713
--- /dev/null
+++ b/misc/systemd/nix-daemon.service.in
@@ -0,0 +1,9 @@
+[Unit]
+Description=Nix Daemon
+RequiresMountsFor=@storedir@
+RequiresMountsFor=@localstatedir@
+ConditionPathIsReadWrite=@localstatedir@/nix/daemon-socket
+
+[Service]
+ExecStart=@@bindir@/nix-daemon nix-daemon --daemon
+KillMode=process
diff --git a/misc/systemd/nix-daemon.socket.in b/misc/systemd/nix-daemon.socket.in
new file mode 100644
index 000000000000..9ed39ffe6eb2
--- /dev/null
+++ b/misc/systemd/nix-daemon.socket.in
@@ -0,0 +1,11 @@
+[Unit]
+Description=Nix Daemon Socket
+Before=multi-user.target
+RequiresMountsFor=@storedir@
+ConditionPathIsReadWrite=@localstatedir@/nix/daemon-socket
+
+[Socket]
+ListenStream=@localstatedir@/nix/daemon-socket/socket
+
+[Install]
+WantedBy=sockets.target