From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id AMO3JcNSU2EvYQEAgWs5BA (envelope-from ) for ; Tue, 28 Sep 2021 19:37:07 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id uEl9IcNSU2HXMwAA1q6Kng (envelope-from ) for ; Tue, 28 Sep 2021 17:37:07 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 464C11006D for ; Tue, 28 Sep 2021 19:37:07 +0200 (CEST) Received: from localhost ([::1]:44168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVH2Q-0004MT-F7 for larch@yhetil.org; Tue, 28 Sep 2021 13:37:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVH2M-0004M4-AK for guix-patches@gnu.org; Tue, 28 Sep 2021 13:37:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35389) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVH2M-0006fw-2b; Tue, 28 Sep 2021 13:37:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mVH2L-0001F0-RE; Tue, 28 Sep 2021 13:37:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50873] [PATCH 2/5] guix home: import: Allow multiple modules to be imported for each service. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, andrew@trop.in, guix-patches@gnu.org Resent-Date: Tue, 28 Sep 2021 17:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50873 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50873@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Andrew Tropin X-Debbugs-Original-Xcc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Andrew Tropin Received: via spool by 50873-submit@debbugs.gnu.org id=B50873.16328505654668 (code B ref 50873); Tue, 28 Sep 2021 17:37:01 +0000 Received: (at 50873) by debbugs.gnu.org; 28 Sep 2021 17:36:05 +0000 Received: from localhost ([127.0.0.1]:46923 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mVH1G-0001CW-Jf for submit@debbugs.gnu.org; Tue, 28 Sep 2021 13:36:05 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:33270 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mVH1F-0001CJ-2K for 50873@debbugs.gnu.org; Tue, 28 Sep 2021 13:35:53 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1632850547; bh=RylSVc8nuJeWHmXsVlgB+ho4C05ujXWj1OBhUFCaHpA=; h=From:To:Subject:In-Reply-To:References:Date; b=LIaTdDgNdqDhaww0r7qWW/Qrf42p3JhR3CymYzhBL4H/Heo3R8csPCFwWW001s9S8 WxgSTkfCQTlqqyre93CPCDw7dGBlZWthVxNM9WqJWM3EBLNORl6PMWNY/Zw567Y03P 39A0mQI0iixW+XTIt+I1CubVLzcBkydU+sego3n4= In-Reply-To: References: Message-Id: <100bd160a58a65442ec68fb2f83e2dc3291224e0.1632849969.git.public@yoctocell.xyz> Date: Tue, 28 Sep 2021 19:35:47 +0200 MIME-Version: 1.0 Content-Type: text/plain 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1632850627; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=sRDfSW1ygjlFl2ySM5JD1yJsoveA3syTJaKXR7L6l8E=; b=M3L1dKHD/nZaqlY3GPumNCOevy2k3mvkVlYY/cZM6x8EDrsdSIF+qA5kCV3DF7FIh51dn+ FR8HLY6ICHF56ZMMqdBcz0lHAUo6eVDFjJ9A9pUOor0LjAjWDzCJYdODXRfQ6NkTCaG5Uu d6hmj/ZJLF62GYA0o0aX2iNFIMYIeANfIMiqP2EMlGyVSKXTHouoyOhFtsI/MGA5sSDWLd PwnIM5QzIxsXp7velBNvA1WAYIImC2D6HjuOeimI7K1nyes+nSu83XfLDovFGj35Cb20vr nviGSWxldYft/nES3G3suAlSNJIzxHLVqyAP7QUEmk064A8Eg77WcFlbwnF3og== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632850627; a=rsa-sha256; cv=none; b=SVUB7dfiI7nEJ+qBMkS4MeNQrCDpwtAN/oxP+IxoqAge+hRwp2e6pxrEGx0UtsBp/Ptgt8 PaGItyset1ZBVl5qU2Fv1lh+p79XcovVy52mjD7EKINShjv/6k2eMKg2RzAHfhx20p9DM5 xf7I90oq4hkiwQT69CkNGsk2SffWvs77aBFk0Pz3Jz3VcecxdtrqDRsYWfE34rCBOf9LTA E0F4v44cNmMilj6lcbekiAfKtQjqgl6UUK01I+tMfyqebFsQYTH/dAP4nl9AoSFpy5/f9E QYfUoK4yFJ7jLeocUEpNgV45wg+/lL05ljv2siDttEvFlG2PsXgskBH2kcEGOw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b=LIaTdDgN; dmarc=fail reason="SPF not aligned (relaxed)" header.from=yoctocell.xyz (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -0.30 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b=LIaTdDgN; dmarc=fail reason="SPF not aligned (relaxed)" header.from=yoctocell.xyz (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 464C11006D X-Spam-Score: -0.30 X-Migadu-Scanner: scn0.migadu.com X-TUID: XoHrg07sVcts Previously, only one module could be imported for each service, e.g., only (gnu home-services shell) could be imported when generating the Bash service declaration. However, for some services, multiple modules might need to be imported in order for it to work. * guix/scripts/home/import.scm (generate-bash-module+configuration): Rename to ... (generate-bash-configuration+modules): ... this. (%files-configurations-alist): Rename to ... (%files+configurations-alist): ... this. (modules+configurations): Rename to ... (configurations+modules): ... this. (manifest->code): Adjust accordingly. --- guix/scripts/home/import.scm | 43 ++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm index a6ab68a32c..ad926fa202 100644 --- a/guix/scripts/home/import.scm +++ b/guix/scripts/home/import.scm @@ -40,15 +40,14 @@ (define-module (guix scripts home import) (define %destination-directory (make-parameter (string-append (getenv "HOME") "/src/guix-config"))) -(define (generate-bash-module+configuration) +(define (generate-bash-configuration+modules) (define (destination-append path) (string-append (%destination-directory) "/" path)) (let ((rc (destination-append ".bashrc")) (profile (destination-append ".bash_profile")) (logout (destination-append ".bash_logout"))) - `((gnu home-services bash) - (service home-bash-service-type + `((service home-bash-service-type (home-bash-configuration ,@(if (file-exists? rc) `((bashrc @@ -64,14 +63,16 @@ (define (destination-append path) `((bash-logout (list (slurp-file-gexp (local-file ,logout))))) - '())))))) + '()))) + (gnu home-services bash)))) -(define %files-configurations-alist - `((".bashrc" . ,generate-bash-module+configuration) - (".bash_profile" . ,generate-bash-module+configuration) - (".bash_logout" . ,generate-bash-module+configuration))) -(define (modules+configurations) +(define %files+configurations-alist + `((".bashrc" . ,generate-bash-configuration+modules) + (".bash_profile" . ,generate-bash-configuration+modules) + (".bash_logout" . ,generate-bash-configuration+modules))) + +(define (configurations+modules) (define configurations (delete-duplicates (filter-map (match-lambda @@ -85,11 +86,11 @@ (define configurations (%destination-directory) "/" file)) proc) #f)))) - %files-configurations-alist) + %files+configurations-alist) (lambda (x y) (equal? (procedure-name x) (procedure-name y))))) - (map (lambda (proc) (proc)) configurations)) + (map (lambda (proc) (proc)) configurations)) ;; Based on `manifest->code' from (guix profiles) ;; MAYBE: Upstream it? @@ -144,14 +145,14 @@ (define (qualified-name entry) ":" output)))) (manifest-entries manifest)))) (if home-environment? - (let ((modules+configurations (modules+configurations))) + (let ((configurations+modules (configurations+modules))) `(begin - (use-modules (gnu home) - (gnu packages) - ,@(map first modules+configurations)) - ,(home-environment-template - #:specs specs - #:services (map second modules+configurations)))) + (use-modules (gnu home) + (gnu packages) + ,@(concatenate (map cdr configurations+modules))) + ,(home-environment-template + #:specs specs + #:services (map first configurations+modules)))) `(begin (use-modules (gnu packages)) @@ -186,18 +187,18 @@ (define name (options->transformation ',options)))) transformation-procedures))) (if home-environment? - (let ((modules+configurations (modules+configurations))) + (let ((configurations+modules (configurations+modules))) `(begin (use-modules (guix transformations) (gnu home) (gnu packages) - ,@(map first modules+configurations)) + ,@(concatenate (map cdr configurations+modules))) ,@transformations ,(home-environment-template #:packages packages - #:services (map second modules+configurations)))) + #:services (map first configurations+modules)))) `(begin (use-modules (guix transformations) (gnu packages)) -- 2.33.0