GNU bug report logs - #77288
[PATCH 0/6] Rootless guix-daemon on Guix System

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Wed, 26 Mar 2025 16:50:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: 77288 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>, Christopher Baines <guix <at> cbaines.net>, Josselin Poiret <dev <at> jpoiret.xyz>, Ludovic Courtès <ludo <at> gnu.org>, Mathieu Othacehe <othacehe <at> gnu.org>, Simon Tournier <zimon.toutoune <at> gmail.com>, Tobias Geerinckx-Rice <me <at> tobias.gr>
Subject: [bug#77288] [PATCH v2 1/8] self: Install systemd ‘.service’ files.
Date: Thu, 17 Apr 2025 16:21:36 +0200
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
---
 guix/self.scm | 42 ++++++++++++++++++++++++++++++++----------
 1 file 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 <at> gnu.org>
+;;; Copyright © 2017-2023, 2025 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2020 Martin Becze <mjbecze <at> riseup.net>
 ;;; Copyright © 2023 Janneke Nieuwenhuizen <janneke <at> gnu.org>
 ;;; Copyright © 2024 gemmaro <gemmaro.dev <at> gmail.com>
@@ -666,24 +666,40 @@ (define* (guix-command modules
                 ;; 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 "guix-daemon.cil" build))
+  (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"))
+
+(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 @@ (define (miscellaneous-files source daemon)
                    ,(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"))
-- 
2.49.0





This bug report was last modified 90 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.