On systems with SystemD, install the service descriptor for nix-worker, and enable and start it

This commit is contained in:
Michel Alexandre Salim 2012-05-27 17:34:49 +07:00 committed by Eelco Dolstra
parent 8922346305
commit a7ed1f67ee
2 changed files with 28 additions and 0 deletions

View file

@ -0,0 +1,12 @@
[Unit]
Description=Helper daemon for managing secure, multi-user Nix stores
After=syslog.target
[Service]
Type=simple
#PIDFile=/var/run/tuned/tuned.pid
#BusName=com.redhat.tuned
ExecStart=/usr/bin/nix-worker --daemon
[Install]
WantedBy=multi-user.target

View file

@ -137,6 +137,14 @@ done
# (until this is fixed in the relevant Makefile) # (until this is fixed in the relevant Makefile)
chmod -x $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/nix.sh 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-worker.service \
$RPM_BUILD_ROOT%{_prefix}/lib/systemd/system/
%endif
# Copy the byte-compiled mode file by hand # Copy the byte-compiled mode file by hand
cp -p misc/emacs/nix-mode.elc $RPM_BUILD_ROOT%{_emacs_sitelispdir}/ cp -p misc/emacs/nix-mode.elc $RPM_BUILD_ROOT%{_emacs_sitelispdir}/
@ -165,6 +173,11 @@ done
%post %post
chgrp %{nixbld_group} /nix/store chgrp %{nixbld_group} /nix/store
chmod 1775 /nix/store chmod 1775 /nix/store
%if ! 0%{?rhel}
# Enable and start Nix worker
systemctl enable nix-worker.service
systemctl start nix-worker.service
%endif
%files %files
%doc COPYING AUTHORS README %doc COPYING AUTHORS README
@ -174,6 +187,9 @@ chmod 1775 /nix/store
%{perl_vendorarch}/* %{perl_vendorarch}/*
%exclude %dir %{perl_vendorarch}/auto/ %exclude %dir %{perl_vendorarch}/auto/
%{_prefix}/libexec/* %{_prefix}/libexec/*
%if ! 0%{?rhel}
%{_prefix}/lib/systemd/system/nix-worker.service
%endif
%{_datadir}/emacs/site-lisp/nix-mode.el %{_datadir}/emacs/site-lisp/nix-mode.el
%{_datadir}/nix %{_datadir}/nix
%{_mandir}/man1/nix-*.1* %{_mandir}/man1/nix-*.1*