diff options
author | Ludovic Courtès <ludo@gnu.org> | 2025-04-17 11:41:01 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2025-04-20 17:58:11 +0200 |
commit | efcce99acb45681fddd1849fd81f9fdc85471649 (patch) | |
tree | 60ea583db6c25b4a5cd6ff619028d7abfbd0aca8 | |
parent | 949da583dd84271b42106336dddc1996423967d9 (diff) | |
download | guix-efcce99acb45681fddd1849fd81f9fdc85471649.tar.gz guix-efcce99acb45681fddd1849fd81f9fdc85471649.zip |
self: Install systemd ‘.service’ files.
This is consistent with the ‘guix’ package and will prove helpful when
people want to replace /etc/systemd/system/guix*.service with newer
versions thereof.
* guix/self.scm (parameterized-file): New procedure, based on…
(selinux-policy): … this. Use ‘parameterized-file’.
(systemd-file): New procedure.
(miscellaneous-files): Add systemd files.
Change-Id: Ia489a955347cf648a86000cc1265769d66c3f0e8
-rw-r--r-- | guix/self.scm | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/guix/self.scm b/guix/self.scm index 28239d53f5..2a99765359 100644 --- a/guix/self.scm +++ b/guix/self.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017-2023 Ludovic Courtès <ludo@gnu.org> +;;; Copyright © 2017-2023, 2025 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net> ;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2024 gemmaro <gemmaro.dev@gmail.com> @@ -666,24 +666,40 @@ load path." ;; Use a 'guile' variant that doesn't complain about locales. #:guile (quiet-guile guile))) -(define (selinux-policy source daemon) - "Return the SELinux policy file taken from SOURCE and adjusted to refer to -DAEMON and to the current configuration variables." +(define (parameterized-file source daemon file name) + "Return FILE taken from SOURCE (typically a '.in' file) and adjusted to +refer to DAEMON and to the current configuration variables." (define build (with-imported-modules '((guix build utils)) #~(begin (use-modules (guix build utils)) - (copy-file #+(file-append* source "/etc/guix-daemon.cil.in") - "guix-daemon.cil") - (substitute* "guix-daemon.cil" + (fluid-set! %default-port-encoding "UTF-8") + (copy-file #+(file-append* source file) #$name) + (substitute* #$name (("@guix_sysconfdir@") #$%sysconfdir) (("@guix_localstatedir@") #$%localstatedir) + (("@localstatedir@") #$%localstatedir) (("@storedir@") #$%storedir) - (("@prefix@") #$daemon)) - (copy-file "guix-daemon.cil" #$output)))) + (("@prefix@") #$daemon) + (("@GUIX_SUBSTITUTE_URLS@") + #$(string-join %default-substitute-urls))) + (copy-file #$name #$output)))) + + (computed-file name build)) + +(define (selinux-policy source daemon) + "Return the SELinux policy file taken from SOURCE and adjusted to refer to +DAEMON and to the current configuration variables." + (parameterized-file source daemon + "etc/guix-daemon.cil.in" + "guix-daemon.cil")) - (computed-file "guix-daemon.cil" build)) +(define (systemd-file source daemon file) + "Return the given systemd file from SOURCE parameterized for DAEMON." + (parameterized-file source daemon + (string-append "etc/" file ".in") + file)) (define (miscellaneous-files source daemon) "Return data files taken from SOURCE." @@ -698,6 +714,12 @@ DAEMON and to the current configuration variables." ,(file-append* source "/etc/completion/fish/guix.fish")) ("share/selinux/guix-daemon.cil" ,(selinux-policy source daemon)) + ,@(map (lambda (file) + `(,(string-append "lib/systemd/system/" file) + ,(systemd-file source daemon file))) + '("guix-gc.service" + "guix-publish.service" + "guix-daemon.service")) ("share/guix/berlin.guix.gnu.org.pub" ,(file-append* source "/etc/substitutes/berlin.guix.gnu.org.pub")) |