Add 'guix-daemon.service' file for systemd.

* etc/guix-daemon.service.in: New file, provided by Ricardo Wurmus.
* daemon.am (CLEANFILES): Add etc/guix-daemon.service.
  (systemdservicedir, nodist_systemdservice_DATA): New variables.
  (EXTRA_DIST): Add etc/guix-daemon.service.in.
* doc/guix.texi (Binary Installation, Build Environment Setup): Mention
  'guix-daemon.service'.
This commit is contained in:
Ludovic Courtès 2015-07-15 17:13:16 +02:00
parent 64720891ae
commit d2825c9614
4 changed files with 39 additions and 4 deletions

1
.gitignore vendored
View File

@ -125,3 +125,4 @@ GTAGS
/doc/os-config-bare-bones.texi /doc/os-config-bare-bones.texi
/doc/os-config-desktop.texi /doc/os-config-desktop.texi
/doc/*.1 /doc/*.1
/etc/guix-daemon.service

View File

@ -21,7 +21,7 @@
# #
BUILT_SOURCES += nix/libstore/schema.sql.hh BUILT_SOURCES += nix/libstore/schema.sql.hh
CLEANFILES += $(BUILT_SOURCES) CLEANFILES += $(BUILT_SOURCES) etc/guix-daemon.service
noinst_LIBRARIES = libformat.a libutil.a libstore.a noinst_LIBRARIES = libformat.a libutil.a libstore.a
@ -181,10 +181,21 @@ endif BUILD_DAEMON_OFFLOAD
nodist_libexec_SCRIPTS = \ nodist_libexec_SCRIPTS = \
nix/scripts/guix-authenticate nix/scripts/guix-authenticate
# The '.service' file for systemd.
systemdservicedir = $(libdir)/systemd/system
nodist_systemdservice_DATA = etc/guix-daemon.service
etc/guix-daemon.service: etc/guix-daemon.service.in \
$(top_builddir)/config.status
$(SED) -e 's|@''bindir''@|$(bindir)|' < \
"etc/guix-daemon.service.in" > "$@.tmp"
mv "$@.tmp" "$@"
EXTRA_DIST += \ EXTRA_DIST += \
nix/libstore/schema.sql \ nix/libstore/schema.sql \
nix/AUTHORS \ nix/AUTHORS \
nix/COPYING nix/COPYING \
etc/guix-daemon.service.in
AM_TESTS_ENVIRONMENT += \ AM_TESTS_ENVIRONMENT += \
top_builddir="$(abs_top_builddir)" top_builddir="$(abs_top_builddir)"

View File

@ -330,6 +330,10 @@ Run the daemon:
# ~root/.guix-profile/bin/guix-daemon --build-users-group=guixbuild # ~root/.guix-profile/bin/guix-daemon --build-users-group=guixbuild
@end example @end example
On hosts using the systemd init system, drop
@file{~root/.guix-profile/lib/systemd/system/guix-daemon.service} in
@file{/etc/systemd/system}.
@item @item
Make the @command{guix} command available to other users on the machine, Make the @command{guix} command available to other users on the machine,
for instance with: for instance with:
@ -512,8 +516,12 @@ Bash syntax and the @code{shadow} commands):
@noindent @noindent
The number of build users determines how many build jobs may run in The number of build users determines how many build jobs may run in
parallel, as specified by the @option{--max-jobs} option parallel, as specified by the @option{--max-jobs} option
(@pxref{Invoking guix-daemon, @option{--max-jobs}}). (@pxref{Invoking guix-daemon, @option{--max-jobs}}). The
The @code{guix-daemon} program may then be run as @code{root} with: @code{guix-daemon} program may then be run as @code{root} with the
following command@footnote{If your machine uses the systemd init system,
dropping the @file{@var{prefix}/lib/systemd/system/guix-daemon.service}
file in @file{/etc/systemd/system} will ensure that
@command{guix-daemon} is automatically started.}:
@example @example
# guix-daemon --build-users-group=guixbuild # guix-daemon --build-users-group=guixbuild

View File

@ -0,0 +1,15 @@
# This is a "service unit file" for the systemd init system to launch
# 'guix-daemon'. Drop it in /etc/systemd/system or similar to have
# 'guix-daemon' automatically started.
[Unit]
Description=Build daemon for GNU Guix
[Service]
ExecStart=@bindir@/guix-daemon --build-users-group=guixbuild
RemainAfterExit=yes
StandardOutput=syslog
StandardError=syslog
[Install]
WantedBy=multi-user.target