etc: Add explicit ‘--substitute-urls’ in guix-daemon service files.

Having substitute URLs explicitly listed in the service startup file
makes it clearer what should be modified to permanently change the list
of substitute URLs.

* config-daemon.ac: Rename ‘guix_substitute_urls’ to
‘GUIX_SUBSTITUTE_URLS’ and substitute it.
* nix/local.mk (etc/guix-%.service, etc/init.d/guix-daemon)
(etc/guix-%.conf): Substitute it.
* etc/guix-daemon.conf.in, etc/guix-daemon.service.in,
etc/init.d/guix-daemon.in: Add an explicit ‘--substitute-urls’ option.

Change-Id: Ie491b7fab5c42e54dca582801c03805a85de2bf9
This commit is contained in:
Ludovic Courtès 2024-05-31 10:54:18 +02:00
parent 7c8d38f91e
commit d11b96eb54
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
5 changed files with 20 additions and 13 deletions

View file

@ -106,12 +106,13 @@ if test "x$guix_build_daemon" = "xyes"; then
dnl Determine the appropriate default list of substitute URLs (GnuTLS dnl Determine the appropriate default list of substitute URLs (GnuTLS
dnl is required so we can default to 'https'.) dnl is required so we can default to 'https'.)
guix_substitute_urls="https://bordeaux.guix.gnu.org https://ci.guix.gnu.org" GUIX_SUBSTITUTE_URLS="https://bordeaux.guix.gnu.org https://ci.guix.gnu.org"
AC_MSG_CHECKING([for default substitute URLs]) AC_MSG_CHECKING([for default substitute URLs])
AC_MSG_RESULT([$guix_substitute_urls]) AC_MSG_RESULT([$GUIX_SUBSTITUTE_URLS])
AC_SUBST([GUIX_SUBSTITUTE_URLS])
AC_DEFINE_UNQUOTED([GUIX_SUBSTITUTE_URLS], ["$guix_substitute_urls"], AC_DEFINE_UNQUOTED([GUIX_SUBSTITUTE_URLS], ["$GUIX_SUBSTITUTE_URLS"],
[Default list of substitute URLs used by 'guix-daemon'.]) [Default list of substitute URLs used by 'guix-daemon'.])
dnl Check for Guile-SSH, which is required by 'guix offload'. dnl Check for Guile-SSH, which is required by 'guix offload'.

View file

@ -7,4 +7,4 @@ start on runlevel [2345]
stop on runlevel [016] stop on runlevel [016]
exec @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon --build-users-group=guixbuild --discover=no exec @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon --build-users-group=guixbuild --discover=no --substitute-urls='@GUIX_SUBSTITUTE_URLS@'

View file

@ -7,7 +7,8 @@ Description=Build daemon for GNU Guix
[Service] [Service]
ExecStart=@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \ ExecStart=@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \
--build-users-group=guixbuild --discover=no --build-users-group=guixbuild --discover=no \
--substitute-urls='@GUIX_SUBSTITUTE_URLS@'
Environment='GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale' LC_ALL=en_US.utf8 Environment='GUIX_LOCPATH=@localstatedir@/guix/profiles/per-user/root/guix-profile/lib/locale' LC_ALL=en_US.utf8
StandardOutput=journal StandardOutput=journal
StandardError=journal StandardError=journal

View file

@ -36,7 +36,9 @@ start)
-E LC_ALL=en_US.utf8 \ -E LC_ALL=en_US.utf8 \
-p "/var/run/guix-daemon.pid" \ -p "/var/run/guix-daemon.pid" \
@localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \ @localstatedir@/guix/profiles/per-user/root/current-guix/bin/guix-daemon \
--build-users-group=guixbuild --discover=no --build-users-group=guixbuild --discover=no \
--substitute-urls='@GUIX_SUBSTITUTE_URLS@'
fi fi
;; ;;
stop) stop)

View file

@ -1,5 +1,5 @@
# GNU Guix --- Functional package management for GNU # GNU Guix --- Functional package management for GNU
# Copyright © 2012, 2013, 2014, 2015, 2016, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org> # Copyright © 2012-2016, 2018-2020, 2024 Ludovic Courtès <ludo@gnu.org>
# Copyright © 2016 Mathieu Lirzin <mthl@gnu.org> # Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
# Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr> # Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
# #
@ -166,8 +166,9 @@ etc/%.mount: etc/%.mount.in \
etc/guix-%.service: etc/guix-%.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|@''localstatedir''@|$(localstatedir)|' < \ $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' \
"$<" > "$@.tmp"; \ -e 's|@''GUIX_SUBSTITUTE_URLS''@|$(GUIX_SUBSTITUTE_URLS)|' \
< "$<" > "$@.tmp"; \
mv "$@.tmp" "$@" mv "$@.tmp" "$@"
# The service script for sysvinit. # The service script for sysvinit.
@ -177,8 +178,9 @@ nodist_sysvinitservice_DATA = etc/init.d/guix-daemon
etc/init.d/guix-daemon: etc/init.d/guix-daemon.in \ etc/init.d/guix-daemon: etc/init.d/guix-daemon.in \
$(top_builddir)/config.status $(top_builddir)/config.status
$(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \ $(AM_V_GEN)$(MKDIR_P) "`dirname $@`"; \
$(SED) -e 's|@''localstatedir''@|$(localstatedir)|' < \ $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' \
"$<" > "$@.tmp"; \ -e 's|@''GUIX_SUBSTITUTE_URLS''@|$(GUIX_SUBSTITUTE_URLS)|' \
< "$<" > "$@.tmp"; \
mv "$@.tmp" "$@" mv "$@.tmp" "$@"
# The service script for openrc. # The service script for openrc.
@ -199,8 +201,9 @@ nodist_upstartjob_DATA = etc/guix-daemon.conf etc/guix-publish.conf
etc/guix-%.conf: etc/guix-%.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|@''localstatedir''@|$(localstatedir)|' < \ $(SED) -e 's|@''localstatedir''@|$(localstatedir)|' \
"$<" > "$@.tmp"; \ -e 's|@''GUIX_SUBSTITUTE_URLS''@|$(GUIX_SUBSTITUTE_URLS)|' \
< "$<" > "$@.tmp"; \
mv "$@.tmp" "$@" mv "$@.tmp" "$@"
CLEANFILES += \ CLEANFILES += \