From patchwork Sun Nov 7 11:13:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Xinglu Chen X-Patchwork-Id: 34291 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 2FDC227BBE1; Sun, 7 Nov 2021 11:14:11 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 805D927BBE3 for ; Sun, 7 Nov 2021 11:14:10 +0000 (GMT) Received: from localhost ([::1]:46412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mjg7l-0006ef-J1 for patchwork@mira.cbaines.net; Sun, 07 Nov 2021 06:14:09 -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?b?4oCYZ3VpeA==?= home =?utf-8?b?aW1wb3J04oCZ?= populate =?utf-8?q?=E2=80=98home-configuration=2Es?= =?utf-8?q?cm?= 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 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/scripts/home.scm (process-command): Populate ‘home-configuration.scm’ 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ès --- doc/guix.texi | 34 +++++++--------------------------- guix/scripts/home.scm | 7 ++++++- 2 files changed, 13 insertions(+), 28 deletions(-) base-commit: 1ffc0a6be3c1613b2d99ceea098174d1f11f6f3f 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. 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}). @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 files of your home environment. Run 'guix home reconfigure /home/alice/guix-config/home-configuration.scm' to make it take effect. @end example @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 files \ +of your home environment. Run 'guix home reconfigure ~a/home-configuration.scm' \ +to make it take effect.") destination destination))) ((describe) (match (generation-number %guix-home) (0