Add system start-up files for "guix publish".

* .gitignore: add etc/guix-publish.conf and /etc/guix-publish.service.
* etc/guix-publish.conf.in: New file.
* etc/guix-publish.service.in: New file.
* nix/local.mk (etc/guix-%.service, etc/guix-%.conf): Generalized former
  build-rules for by using patterns.
  (nodist_systemdservice_DATA): Add etc/guix-publish.service, update
  comment.
  (nodist_upstartjob_DATA): Add etc/guix-publish.conf, update comment.
* doc/guix.texi (Invoking guix publish): Add description for enabling
  "guix publish" on host distros using the new files.
This commit is contained in:
Hartmut Goebel 2016-11-24 09:23:11 +01:00
parent b7230de54b
commit 332d7903f5
No known key found for this signature in database
GPG key ID: 634A8DFFD3F631DF
5 changed files with 65 additions and 8 deletions

2
.gitignore vendored
View file

@ -50,6 +50,8 @@
/emacs/guix-helper.scm /emacs/guix-helper.scm
/etc/guix-daemon.conf /etc/guix-daemon.conf
/etc/guix-daemon.service /etc/guix-daemon.service
/etc/guix-publish.conf
/etc/guix-publish.service
/guix-daemon /guix-daemon
/guix-register /guix-register
/guix/config.scm /guix/config.scm

View file

@ -6055,6 +6055,30 @@ add a call to @code{guix-publish-service} in the @code{services} field
of the @code{operating-system} declaration (@pxref{guix-publish-service, of the @code{operating-system} declaration (@pxref{guix-publish-service,
@code{guix-publish-service}}). @code{guix-publish-service}}).
If you are instead running Guix on a ``foreign distro'', follow these
instructions:”
@itemize
@item
If your host distro uses the systemd init system:
@example
# ln -s ~root/.guix-profile/lib/systemd/system/guix-publish.service \
/etc/systemd/system/
# systemctl start guix-publish && systemctl enable guix-publish
@end example
@item
If your host distro uses the Upstart init system:
@example
# ln -s ~root/.guix-profile/lib/upstart/system/guix-publish.conf /etc/init/
# start guix-publish
@end example
@item
Otherwise, proceed similarly with your distro's init system.
@end itemize
@node Invoking guix challenge @node Invoking guix challenge
@section Invoking @command{guix challenge} @section Invoking @command{guix challenge}

12
etc/guix-publish.conf.in Normal file
View file

@ -0,0 +1,12 @@
# This is a "job" for the Upstart init system to launch 'guix-daemon'.
# Drop it in /etc/init to have 'guix-daemon' automatically started.
description "Publish the GNU Guix store"
start on runlevel [2345]
stop on runlevel [016]
task
exec @bindir@/guix publish --user=nobody --port=8181

View file

@ -0,0 +1,19 @@
# This is a "service unit file" for the systemd init system to launch
# 'guix publish'. Drop it in /etc/systemd/system or similar to have
# 'guix publish' automatically started.
[Unit]
Description=Publish the GNU Guix store
[Service]
ExecStart=@bindir@/guix publish --user=nobody --port=8181
Environment=GUIX_LOCPATH=/root/.guix-profile/lib/locale
RemainAfterExit=yes
StandardOutput=syslog
StandardError=syslog
# See <https://lists.gnu.org/archive/html/guix-devel/2016-04/msg00608.html>.
TasksMax=1024
[Install]
WantedBy=multi-user.target

View file

@ -183,26 +183,26 @@ endif BUILD_DAEMON_OFFLOAD
nodist_libexec_SCRIPTS = \ nodist_libexec_SCRIPTS = \
%D%/scripts/guix-authenticate %D%/scripts/guix-authenticate
# The '.service' file for systemd. # The '.service' files for systemd.
systemdservicedir = $(libdir)/systemd/system systemdservicedir = $(libdir)/systemd/system
nodist_systemdservice_DATA = etc/guix-daemon.service nodist_systemdservice_DATA = etc/guix-daemon.service etc/guix-publish.service
etc/guix-daemon.service: etc/guix-daemon.service.in \ etc/guix-%.service: etc/guix-%.service.in \
$(top_builddir)/config.status $(top_builddir)/config.status
$(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \ $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
$(SED) -e 's|@''bindir''@|$(bindir)|' < \ $(SED) -e 's|@''bindir''@|$(bindir)|' < \
"$(srcdir)/etc/guix-daemon.service.in" > "$@.tmp"; \ "$(srcdir)/$<" > "$@.tmp"; \
mv "$@.tmp" "$@" mv "$@.tmp" "$@"
# The '.conf' job for Upstart. # The '.conf' jobs for Upstart.
upstartjobdir = $(libdir)/upstart/system upstartjobdir = $(libdir)/upstart/system
nodist_upstartjob_DATA = etc/guix-daemon.conf nodist_upstartjob_DATA = etc/guix-daemon.conf etc/guix-publish.conf
etc/guix-daemon.conf: etc/guix-daemon.conf.in \ etc/guix-%.conf: etc/guix-%.conf.in \
$(top_builddir)/config.status $(top_builddir)/config.status
$(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \ $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
$(SED) -e 's|@''bindir''@|$(bindir)|' < \ $(SED) -e 's|@''bindir''@|$(bindir)|' < \
"$(srcdir)/etc/guix-daemon.conf.in" > "$@.tmp"; \ "$(srcdir)/$<" > "$@.tmp"; \
mv "$@.tmp" "$@" mv "$@.tmp" "$@"
EXTRA_DIST += \ EXTRA_DIST += \