From patchwork Sat Mar 22 18:23:34 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: 40649 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 BEC8927BBEA; Sat, 22 Mar 2025 18:25:11 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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=ham 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 F360B27BBE2 for ; Sat, 22 Mar 2025 18:25:09 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tw3Wp-0003Km-Ql; Sat, 22 Mar 2025 14:25:03 -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 1tw3Wo-0003KB-6G for guix-patches@gnu.org; Sat, 22 Mar 2025 14:25:02 -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 1tw3Wn-0007Sl-Qx for guix-patches@gnu.org; Sat, 22 Mar 2025 14:25:01 -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=ouYdNfaC0QwHW11cPWbtQzpWy1fT9SCFNFQGRqlUg78=; b=VGGuaMUp072H4+ABV4NiQRrbK6AwKz5ip5Cv8HPv0JtOSzV4wCZBGAk+ocsIKcVd3tO/kNU584Vjo0Bgt4peePMnTX2DkunNkhZS2zJctX+SZgt2AUGbrLDE91epzPauFf7MWK2pP4EjTw5FVg9z034KiZsvq+QJLWBoPys7fW2C0ZfWfkZp7QHRSqI0w80ainiMVtOVRfqPXCUqslblkFFVJzQY/3yaaJOAE0E1zclQ5y3Mfh2jhbZqKE+T2QlxP8v43tfvh96QevXWt8FCTS8zO+LcDBRqAaP/XDlVGV+9Zl7E3xC6Im8eOv51pX3NdUQ7iBz1oTlFi/EWj/0FcA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tw3Wn-0007vL-Lf for guix-patches@gnu.org; Sat, 22 Mar 2025 14:25:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77189] [PATCH 1/3] services: guix: Factorize =?utf-8?b?4oCY?= =?utf-8?b?Z3VpeC1kYWVtb27igJk=?= arguments. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 22 Mar 2025 18:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77189 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77189@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 77189-submit@debbugs.gnu.org id=B77189.174266784730233 (code B ref 77189); Sat, 22 Mar 2025 18:25:01 +0000 Received: (at 77189) by debbugs.gnu.org; 22 Mar 2025 18:24:07 +0000 Received: from localhost ([127.0.0.1]:45402 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tw3Vu-0007rX-Eg for submit@debbugs.gnu.org; Sat, 22 Mar 2025 14:24:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59288) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tw3Vq-0007qP-Qh for 77189@debbugs.gnu.org; Sat, 22 Mar 2025 14:24:03 -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 1tw3Vl-0007Mm-Gw; Sat, 22 Mar 2025 14:23:57 -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=ouYdNfaC0QwHW11cPWbtQzpWy1fT9SCFNFQGRqlUg78=; b=hFpAjMZIZ2myAO/QBrvb Eq5Gl1g3s+JWf20VNNQnL+BSbaH4oPK3v8ZIMLFupF0PAO4gysR1mwHy+KzWtWNKIpNuvpMuoW2zW eXTgEbwy9Ps6rHRCt8JnMxch6e037jTtXosOc/X1r0NSFL55ju0NEECHy0g2AazXIUSfU/nSj2Gq5 pT94ynEb0BLIj+mUi3U/GM48qDcN68ZVNsWotkv5bQhjWkt7Z4ovacpqfzGx2J7hCe6sKYzOm38GY Pw4k0X3m/vp3FRwcGbG0hEyHNnJkBuP/JbEH/ZgHMCPVtXtyx/S+F8tbTybsQT8Q3kWvgqVLI3Ppz T1Z1/YdgkiRaow==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sat, 22 Mar 2025 19:23:34 +0100 Message-ID: <7dbcbbbd99883ac9c4655447ab0df451dfc59b94.1742667082.git.ludo@gnu.org> X-Mailer: git-send-email 2.48.1 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 * gnu/services/base.scm (guix-shepherd-service): In ‘start’ method, move ‘fork+exec-command/container’ arguments to the new variables ‘daemon-command’ and ‘environment-variables’. Change-Id: Ic04a1006849697e4e185ad94185bbdec8a91a05a --- gnu/services/base.scm | 115 ++++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 56 deletions(-) diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 0d2bb31190..6793822666 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -2061,6 +2061,63 @@ (define (guix-shepherd-service config) (define discover? (or (getenv "discover") #$discover?)) + (define daemon-command + (cons* #$(file-append guix "/bin/guix-daemon") + "--build-users-group" #$build-group + "--max-silent-time" + #$(number->string max-silent-time) + "--timeout" #$(number->string timeout) + "--log-compression" + #$(symbol->string log-compression) + #$@(if use-substitutes? + '() + '("--no-substitutes")) + (string-append "--discover=" + (if discover? "yes" "no")) + "--substitute-urls" #$(string-join substitute-urls) + #$@extra-options + + #$@(if chroot? + '() + '("--disable-chroot")) + ;; Add CHROOT-DIRECTORIES and all their dependencies + ;; (if these are store items) to the chroot. + (append-map + (lambda (file) + (append-map (lambda (directory) + (list "--chroot-directory" + directory)) + (call-with-input-file file + read))) + '#$(map references-file + chroot-directories)))) + + (define environment-variables + (append (list #$@(if tmpdir + (list (string-append "TMPDIR=" tmpdir)) + '()) + + ;; Make sure we run in a UTF-8 locale so that + ;; 'guix offload' correctly restores nars + ;; that contain UTF-8 file names such as + ;; 'nss-certs'. See + ;; . + (string-append "GUIX_LOCPATH=" + #$locales "/lib/locale") + "LC_ALL=en_US.utf8" + ;; Make 'tar' and 'gzip' available so + ;; that 'guix perform-download' can use + ;; them when downloading from Software + ;; Heritage via '(guix swh)'. + (string-append "PATH=" + #$(file-append tar "/bin") ":" + #$(file-append gzip "/bin"))) + (if proxy + (list (string-append "http_proxy=" proxy) + (string-append "https_proxy=" proxy)) + '()) + '#$environment)) + (mkdir-p "/var/guix") ;; Ensure that a fresh directory is used, in case the old ;; one was more permissive and processes have a file @@ -2084,35 +2141,7 @@ (define (guix-shepherd-service config) ;; to solve an installation issue. See the comment below for ;; more details. (fork+exec-command/container - (cons* #$(file-append guix "/bin/guix-daemon") - "--build-users-group" #$build-group - "--max-silent-time" - #$(number->string max-silent-time) - "--timeout" #$(number->string timeout) - "--log-compression" - #$(symbol->string log-compression) - #$@(if use-substitutes? - '() - '("--no-substitutes")) - (string-append "--discover=" - (if discover? "yes" "no")) - "--substitute-urls" #$(string-join substitute-urls) - #$@extra-options - - #$@(if chroot? - '() - '("--disable-chroot")) - ;; Add CHROOT-DIRECTORIES and all their dependencies - ;; (if these are store items) to the chroot. - (append-map - (lambda (file) - (append-map (lambda (directory) - (list "--chroot-directory" - directory)) - (call-with-input-file file - read))) - '#$(map references-file - chroot-directories))) + daemon-command ;; When running the installer, we need guix-daemon to ;; operate from within the same MNT namespace as the @@ -2123,33 +2152,7 @@ (define (guix-shepherd-service config) #:pid (match args ((pid) (string->number pid)) (else (getpid))) - - #:environment-variables - (append (list #$@(if tmpdir - (list (string-append "TMPDIR=" tmpdir)) - '()) - - ;; Make sure we run in a UTF-8 locale so that - ;; 'guix offload' correctly restores nars - ;; that contain UTF-8 file names such as - ;; 'nss-certs'. See - ;; . - (string-append "GUIX_LOCPATH=" - #$locales "/lib/locale") - "LC_ALL=en_US.utf8" - ;; Make 'tar' and 'gzip' available so - ;; that 'guix perform-download' can use - ;; them when downloading from Software - ;; Heritage via '(guix swh)'. - (string-append "PATH=" - #$(file-append tar "/bin") ":" - #$(file-append gzip "/bin"))) - (if proxy - (list (string-append "http_proxy=" proxy) - (string-append "https_proxy=" proxy)) - '()) - '#$environment) - + #:environment-variables environment-variables #:log-file #$log-file)))) (stop #~(make-kill-destructor))))))