From 84d6936371037559704337614c65007a8e61b5e1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 7 Apr 2014 11:18:54 +0200 Subject: [PATCH] Install systemd units --- .gitignore | 3 +++ Makefile | 1 + misc/systemd/local.mk | 1 + misc/systemd/nix-daemon.service | 10 ---------- misc/systemd/nix-daemon.service.in | 9 +++++++++ misc/systemd/nix-daemon.socket.in | 11 +++++++++++ nix.spec.in | 8 -------- 7 files changed, 25 insertions(+), 18 deletions(-) create mode 100644 misc/systemd/local.mk delete mode 100644 misc/systemd/nix-daemon.service create mode 100644 misc/systemd/nix-daemon.service.in create mode 100644 misc/systemd/nix-daemon.socket.in diff --git a/.gitignore b/.gitignore index 76fc815eb..008f5de8a 100644 --- a/.gitignore +++ b/.gitignore @@ -108,6 +108,9 @@ Makefile.config /perl/lib/Nix/Config.pm /perl/lib/Nix/Store.cc +/misc/systemd/nix-daemon.service +/misc/systemd/nix-daemon.socket + *.a *.o *.so diff --git a/Makefile b/Makefile index bcfa89dd2..77f22db9f 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ makefiles = \ perl/local.mk \ scripts/local.mk \ corepkgs/local.mk \ + misc/systemd/local.mk \ misc/emacs/local.mk \ doc/manual/local.mk \ tests/local.mk diff --git a/misc/systemd/local.mk b/misc/systemd/local.mk new file mode 100644 index 000000000..a5f6131ce --- /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 ee28209f0..000000000 --- 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 000000000..5fc04a3f5 --- /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 000000000..9ed39ffe6 --- /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 diff --git a/nix.spec.in b/nix.spec.in index f067c3896..1457308d1 100644 --- a/nix.spec.in +++ b/nix.spec.in @@ -132,14 +132,6 @@ done # (until this is fixed in the relevant Makefile) chmod -x $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/nix.sh -# systemd not available on RHEL yet -%if ! 0%{?rhel} -# install systemd service descriptor -mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/systemd/system -cp -p misc/systemd/nix-daemon.service \ - $RPM_BUILD_ROOT%{_prefix}/lib/systemd/system/ -%endif - # Copy the byte-compiled mode file by hand cp -p misc/emacs/nix-mode.elc $RPM_BUILD_ROOT%{_emacs_sitelispdir}/