From patchwork Thu Apr 17 14:21:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 41738 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 55CD727BC4B; Thu, 17 Apr 2025 15:24:17 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 9270327BC49 for ; Thu, 17 Apr 2025 15:24:16 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u5Q9N-0000gB-H0; Thu, 17 Apr 2025 10:23:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u5Q8y-0000VM-MW for guix-patches@gnu.org; Thu, 17 Apr 2025 10:23:11 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u5Q8y-0001f8-Bs; Thu, 17 Apr 2025 10:23:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=mtPCkcmWLIjQsjjBWKM0cyrevvUhhUSD9sywJ8G4WU4=; b=pk7iWKr+C5b3AtMI2CgbHoHTrjNtG4B+g9PToEeXyQrdrCDD4z9Q4qpkrh+VBSk1dKwsbX7qUYMO/VbKaggLSRWH8XKq8zYEXS+a5oo3cPD1JjhXsc0olUTWi/2W4yxMd5ZOPuwRhZ8vdQpR83NbQ7n+jlM3zIUVIe8Vv13WJyj+JY5Jy0qUDR7ylpVkCAHU0Ns20wEFD2KfYGT7Y07bSh6DXntCnKcEi8PzHnLtQj9IUHanJSshrTY+QD4Oeu2TdGWT5cEA3uKSLRFDF1+ywvmZCOpbo9VxWe7u18349/vhPv1aHPr7avLK0/KCmoMPSCGfHvBgPmRmnzd17aTZRA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u5Q8u-0004va-22; Thu, 17 Apr 2025 10:23:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77288] [PATCH v2 1/8] self: Install systemd =?utf-8?b?4oCYLnNl?= =?utf-8?b?cnZpY2XigJk=?= files. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Thu, 17 Apr 2025 14:23:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77288 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77288@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 77288-submit@debbugs.gnu.org id=B77288.174489974318716 (code B ref 77288); Thu, 17 Apr 2025 14:23:03 +0000 Received: (at 77288) by debbugs.gnu.org; 17 Apr 2025 14:22:23 +0000 Received: from localhost ([127.0.0.1]:47990 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u5Q8D-0004rm-OU for submit@debbugs.gnu.org; Thu, 17 Apr 2025 10:22:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44866) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u5Q7w-0004oq-L0 for 77288@debbugs.gnu.org; Thu, 17 Apr 2025 10:22:09 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u5Q7r-0001T3-5T; Thu, 17 Apr 2025 10:21:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=mtPCkcmWLIjQsjjBWKM0cyrevvUhhUSD9sywJ8G4WU4=; b=OyCJGmEH1KUvDB6+aO1m eiSSbMdfp1Xj6GrWz8hF0ElQ9kdFuMBuPw4+S3acFP58aWkUalFsB0LW5BEl+XCPgnnkrNyvvjRmQ zuQjND4z3csiKDDvdOz088D860s0/hwZsPgpdreQ/FW61PxvGVmFMTIXWCW2g6me/guKnbgDXd+w2 kH72zQC+uWJ03pCRyFgg90ViNYYThqCpAkJqn+h3aOPZ3DErBggArCET02BtSGwohBPOFrfii1PIw SPARpNyhSprXGjKCltfShLN3YX9Nac/GUlij4GDiiZmUDI3Vw1y1GAB0hFd9nYiNaYi18wiK6wHbG MV8KTJ+UHmXuaQ==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Thu, 17 Apr 2025 16:21:36 +0200 Message-ID: <20e400054c70809a7a920b0c2167f5b07ca3ee1b.1744899444.git.ludo@gnu.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches 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 +;;; Copyright © 2017-2023, 2025 Ludovic Courtès ;;; Copyright © 2020 Martin Becze ;;; Copyright © 2023 Janneke Nieuwenhuizen ;;; Copyright © 2024 gemmaro @@ -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"))