From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id B6yYHLK+YmEIDwAAgWs5BA (envelope-from ) for ; Sun, 10 Oct 2021 12:21:38 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 8COoFrK+YmGbCwAAbx9fmQ (envelope-from ) for ; Sun, 10 Oct 2021 10:21:38 +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 D922221EDF for ; Sun, 10 Oct 2021 12:21:37 +0200 (CEST) Received: from localhost ([::1]:34318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mZVxZ-000441-13 for larch@yhetil.org; Sun, 10 Oct 2021 06:21:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZVx1-0003ah-V7 for guix-patches@gnu.org; Sun, 10 Oct 2021 06:21:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:42964) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mZVx0-000518-I4 for guix-patches@gnu.org; Sun, 10 Oct 2021 06:21:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mZVx0-0003P2-Ex for guix-patches@gnu.org; Sun, 10 Oct 2021 06:21:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50873] [PATCH 2/7] guix home: import: Allow multiple modules to be imported for each service. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 10 Oct 2021 10:21:02 +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: Oleg Pykhalov , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Andrew Tropin Received: via spool by 50873-submit@debbugs.gnu.org id=B50873.163386122212934 (code B ref 50873); Sun, 10 Oct 2021 10:21:02 +0000 Received: (at 50873) by debbugs.gnu.org; 10 Oct 2021 10:20:22 +0000 Received: from localhost ([127.0.0.1]:54493 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mZVwL-0003MY-KL for submit@debbugs.gnu.org; Sun, 10 Oct 2021 06:20:21 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:39738 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mZVwK-0003Lx-0k for 50873@debbugs.gnu.org; Sun, 10 Oct 2021 06:20:20 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1633861214; bh=RylSVc8nuJeWHmXsVlgB+ho4C05ujXWj1OBhUFCaHpA=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=tv7o25WklXQrkSxdiI3OMYWkNnpPT7Wk7mXH0f2SlAC8lseooipjPX9+u+incRQpY HM0gd055AsJlwh/FZ8vNw2V0mXWyCxp2K2MzEVX4AebA21wqYqqLz3kUZeRQs8AH/t td9zgtiePO4xYmrpoQYSFk1HdPaWPF1Yx+o3FkeU= In-Reply-To: References: Message-Id: Date: Sun, 10 Oct 2021 12:20:14 +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=1633861297; 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=GMr2d2SwVe7GyisW8BPrbLbjOe9xub9IwRmIovgvCL1yfhVwRNKjxklt7/Xcg0nZygBxAA jQ+CLdldozHgeZkq1rPSFPIoBRndxDBma1JbuCoLJV8Obx+hjTG1fQxDfRZwZGW9cvFo2D IAx/X1NriZF0wqvhC8uiO07y/eDoG9uvJdTmz7ibp0L4QuTEPpOHgJsQzHCKwBMwv0hmMm zWZudb4YK5xVoKZxY8Foed76vW/XLPqq/Wkkl1cXhl5wlUe16EFmO172vOo8DLUCn45sWK jUF56Z/vSYWp5KkGTSyzQpC3012FLBQx6gOPCDIyx1fIFbXK3ILHbcY8VORwgg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1633861297; a=rsa-sha256; cv=none; b=D4VlHMlp6uizuvvP825nT0LnsTK5WyFnEYdAI3NtWd5kuJfcDwS5o1WI4t1XIXNbVJV7QB imk7giz5egdu3BjvIaVAlD3IwkKr//a2XmaJHlWS8sKnYNDDcGN5wl2W9RqWNnYsU+wMh3 J0SRExRB8FXEdO83PxhvSPc8wj18nlKlt68is9AfM3cRgdTznbSGMY5eqhiu3uO4dCUWHw KMAP53URp+4f/paAhPEKBP4JJT9/3kcu3dhEvWkKAbVm3gFeTIoCc9nlRKBU5q8mxRunZC ojkhz5EolOwmsDQzZSqg2jvxg9dlFOZZFHPYhkV3xVHrScDOK+Ob8PuhhA0izw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b=tv7o25Wk; 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: 1.19 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b=tv7o25Wk; 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: D922221EDF X-Spam-Score: 1.19 X-Migadu-Scanner: scn0.migadu.com X-TUID: wVqHAoF3F9ew 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