about summary refs log tree commit diff
path: root/third_party/nix/misc
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/nix/misc')
-rw-r--r--third_party/nix/misc/meson.build7
-rw-r--r--third_party/nix/misc/systemd/meson.build26
-rw-r--r--third_party/nix/misc/systemd/nix-daemon.service.in12
-rw-r--r--third_party/nix/misc/systemd/nix-daemon.socket.in11
4 files changed, 56 insertions, 0 deletions
diff --git a/third_party/nix/misc/meson.build b/third_party/nix/misc/meson.build
new file mode 100644
index 000000000000..1b381de5a16e
--- /dev/null
+++ b/third_party/nix/misc/meson.build
@@ -0,0 +1,7 @@
+misc_dirs = [
+  'systemd',
+]
+
+foreach dir : misc_dirs
+    subdir(dir)
+endforeach
diff --git a/third_party/nix/misc/systemd/meson.build b/third_party/nix/misc/systemd/meson.build
new file mode 100644
index 000000000000..588f0b3d9d6b
--- /dev/null
+++ b/third_party/nix/misc/systemd/meson.build
@@ -0,0 +1,26 @@
+# nix systemd build file
+#============================================================================
+
+if (sys_name.contains('linux'))
+
+    systemd_data = []
+
+    systemd_nix_daemon = configuration_data()
+    systemd_nix_daemon.set('bindir', bindir)
+    systemd_nix_daemon.set('storedir', nixstoredir)
+    systemd_nix_daemon.set('localstatedir', localstatedir)
+
+    systemd_data += configure_file(
+        input : 'nix-daemon.socket.in',
+        output : 'nix-daemon.socket',
+        configuration : systemd_nix_daemon)
+
+    systemd_data += configure_file(
+        input : 'nix-daemon.service.in',
+        output : 'nix-daemon.service',
+        configuration : systemd_nix_daemon)
+
+    install_data(
+        systemd_data,
+        install_dir : join_paths(prefix, 'lib/systemd/system'))
+endif
diff --git a/third_party/nix/misc/systemd/nix-daemon.service.in b/third_party/nix/misc/systemd/nix-daemon.service.in
new file mode 100644
index 000000000000..25655204d4df
--- /dev/null
+++ b/third_party/nix/misc/systemd/nix-daemon.service.in
@@ -0,0 +1,12 @@
+[Unit]
+Description=Nix Daemon
+RequiresMountsFor=@storedir@
+RequiresMountsFor=@localstatedir@
+ConditionPathIsReadWrite=@localstatedir@/nix/daemon-socket
+
+[Service]
+ExecStart=@@bindir@/nix-daemon nix-daemon --daemon
+KillMode=process
+
+[Install]
+WantedBy=multi-user.target
diff --git a/third_party/nix/misc/systemd/nix-daemon.socket.in b/third_party/nix/misc/systemd/nix-daemon.socket.in
new file mode 100644
index 000000000000..9ed39ffe6eb2
--- /dev/null
+++ b/third_party/nix/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