From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id iOsnMgC1h2FIygAAgWs5BA (envelope-from ) for ; Sun, 07 Nov 2021 12:14:08 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id aJzXLQC1h2FDYwAA1q6Kng (envelope-from ) for ; Sun, 07 Nov 2021 11:14:08 +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 718949A6A for ; Sun, 7 Nov 2021 12:14:08 +0100 (CET) Received: from localhost ([::1]:46412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mjg7j-0006ef-Ha for larch@yhetil.org; Sun, 07 Nov 2021 06:14:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjg7e-0006bo-F9 for guix-patches@gnu.org; Sun, 07 Nov 2021 06:14:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:40360) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mjg7d-0004g4-SX; Sun, 07 Nov 2021 06:14:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mjg7d-0003mg-Nc; Sun, 07 Nov 2021 06:14:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51657] [PATCH] scripts: home: Make =?UTF-8?Q?=E2=80=98guix?= home =?UTF-8?Q?import=E2=80=99?= populate =?UTF-8?Q?=E2=80=98home-configuration.scm?= Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, andrew@trop.in, guix-patches@gnu.org Resent-Date: Sun, 07 Nov 2021 11:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 51657 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51657@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Andrew Tropin X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Andrew Tropin Received: via spool by submit@debbugs.gnu.org id=B.163628362214507 (code B ref -1); Sun, 07 Nov 2021 11:14:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Nov 2021 11:13:42 +0000 Received: from localhost ([127.0.0.1]:51906 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mjg7J-0003lu-IZ for submit@debbugs.gnu.org; Sun, 07 Nov 2021 06:13:41 -0500 Received: from lists.gnu.org ([209.51.188.17]:47692) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mjg7H-0003ll-Gc for submit@debbugs.gnu.org; Sun, 07 Nov 2021 06:13:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjg7H-0006Mt-C8 for guix-patches@gnu.org; Sun, 07 Nov 2021 06:13:39 -0500 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:37864 helo=mail.yoctocell.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjg7F-0004Zl-Ct for guix-patches@gnu.org; Sun, 07 Nov 2021 06:13:39 -0500 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1636283612; bh=uEhMG8LOG1/dcrFEQfZ76DoD0b5jsxGOevAwRSQQH7c=; h=From:To:Subject:Date; b=jikrP/7vzGhgeZHNOF38tG+qtJuFerf9t6BqwsarVLSL7cASghH18+sMNxA1YnqTK JnaCdlKc5qWZL/I2KRCvIaMlTo/w4dy41Uz2dsKG4upXGhDYygxBOPjJ+k9A0bWu3P ggWZ8X7t4b7FDZ6Q13chAlq25OgwheHHhikuQsiQ= Message-Id: <14ec6984221fa50f5720db519cb0f06db4dd478b.1636283518.git.public@yoctocell.xyz> Date: Sun, 07 Nov 2021 12:13:32 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@yoctocell.xyz; helo=mail.yoctocell.xyz X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.001, FROM_SUSPICIOUS_NTLD_FP=1.997, PDS_OTHER_BAD_TLD=0.001, PDS_RDNS_DYNAMIC_FP=0.001, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TO_NO_BRKTS_DYNIP=0.252 autolearn=no autolearn_force=no X-Spam_action: no action 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=1636283648; 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: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=YKi4Z8N3e59aWnOa4UCgzUbQZY4drAKmtA7a4sqeKmE=; b=TLUl0FaMqFnV4ji9FNNZ+x/79IZC7Qj0MjTXyUTdDK3BvDSLj5MniY1IvAM8a4Kpf+xTFA UrdaDdD1hfktrHpQy5LVoeKyj6iUANVTZRJ17BHxRwmNuK+IvHDhtffzySIHMbrVevjemI AT2gzN1VRNFnWaCHq+zZ0bMytpJueHJ1GWyd2q+FyUAi+qru4hf1xvS8uetacpv+3PfBJp JS9d3d/7MOIVFQ/8tXIpQYBSxxyZwKDGjrD5oFyut0LRIiVqJGiYcoHDPRSd//q84ciG6E dfluJFmsN1+V9BZa2O30EfhbxEbLL108GzEYB22Vys1Xia84KLzv2tkyChcAlw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1636283648; a=rsa-sha256; cv=none; b=PftvN9Nm6rkjubSROS3r9JgHRHvt7c41IWY0GCZFMZfpxWGLhJyYN0uJ40bK9sLgwP+bbB TteRUir5hRWMZEIB/FSVbLTL2390GHTniNhAst0ekq95hN7I6lPAC5neugPZq4TH6WFqfP Kaqm/RstVFz/HmjE7AuNfk3G+K06vxHnWKW2MArZcgGKnCZZrfHfIPetK5gpDeSt53yVDk jO5H5qOz/j6biXww0h5FPN2Vq6d7J9dYKChWVp/4EeUuxtQ0NLgJcEs8Hur776ZT8tcK73 26n5sPk7L1xPLXziZrp572NdiTA4n1OmI5/YGsVBmh34zCv/5iNPM+DEBY2AuA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b="jikrP/7v"; 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.32 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b="jikrP/7v"; 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: 718949A6A X-Spam-Score: -0.32 X-Migadu-Scanner: scn0.migadu.com X-TUID: g+PdjAlFTvst * guix/scripts/home.scm (process-command): Populate =E2=80=98home-configura= tion.scm=E2=80=99 in the destination directory instead of printing to stdout. * doc/guix.texi (Declaring the Home Environment): Adjust accordingly. (Invoking guix home): Likewise. Suggested-by: Ludovic Court=C3=A8s --- doc/guix.texi | 34 +++++++--------------------------- guix/scripts/home.scm | 7 ++++++- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index ea1973f02c..ebcc725184 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -35865,9 +35865,8 @@ such as @file{~/.bashrc} found in your home directory and copies them to the given directory, @file{~/src/guix-config} in this case; it also reads the contents of your profile, @file{~/.guix-profile}, and, based -on that, it outputs a Home configuration that resembles your current -configuration. You can dump that configuration to a file and you're -ready to go! +on that, it populates @file{~/src/guix-config/home-configuration.scm} +with a Home configuration that resembles your current configuration. =20 A simple setup can include Bash and a custom text configuration, like in the example below. Don't be afraid to declare home environment parts, @@ -36537,33 +36536,14 @@ @item import Generate a @dfn{home environment} from the packages in the default profile and configuration files found in the user's home directory. The -configuration files will be copied to the specified directory. Note -that not every home service that exists is supported (@pxref{Home -Services}). +configuration files will be copied to the specified directory, and a +@file{home-configuration.scm} will be populated with the home +environment. Note that not every home service that exists is supported +(@pxref{Home Services}). =20 @example $ guix home import ~/guix-config -;; This "home-environment" file can be passed to 'guix home reconfigure' -;; to reproduce the content of your profile. This is "symbolic": it only -;; specifies package names. To reproduce the exact same profile, you also -;; need to capture the channels being used, as returned by "guix describe". -;; See the "Replicating Guix" section in the manual. - -(use-modules - (gnu home) - (gnu packages) - (gnu home services shells)) - -(home-environment - (packages - (map specification->package - (list "glibc-locales" "nss-certs" "nss"))) - (services - (list (service - home-bash-service-type - (home-bash-configuration - (bashrc - (list (local-file "/home/charlie/guix-config/.bashrc")))))= ))) +/home/alice/guix-config has been populated with all the configuration file= s of your home environment. Run 'guix home reconfigure /home/alice/guix-co= nfig/home-configuration.scm' to make it take effect. @end example =20 @end table diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm index 3f48b98ed4..118e66895e 100644 --- a/guix/scripts/home.scm +++ b/guix/scripts/home.scm @@ -274,7 +274,12 @@ (define-syntax-rule (with-store* store exp ...) (_ (leave (G_ "wrong number of arguments~%"))))= )) (unless (file-exists? destination) (mkdir-p destination)) - (import-manifest manifest destination (current-output-port)))) + (call-with-output-file + (string-append destination "/home-configuration.scm") + (cut import-manifest manifest destination <>)) + (format #t (G_ "~a/ has been populated with all the configuration f= iles \ +of your home environment. Run 'guix home reconfigure ~a/home-configuratio= n.scm' \ +to make it take effect.") destination destination))) ((describe) (match (generation-number %guix-home) (0 base-commit: 1ffc0a6be3c1613b2d99ceea098174d1f11f6f3f --=20 2.33.0