GNU bug report logs - #51657
[PATCH] scripts: home: Make ‘guix home import’ populate ‘home-configuration.scm

Previous Next

Package: guix-patches;

Reported by: Xinglu Chen <public <at> yoctocell.xyz>

Date: Sun, 7 Nov 2021 11:14:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51657 in the body.
You can then email your comments to 51657 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to ludo <at> gnu.org, andrew <at> trop.in, guix-patches <at> gnu.org:
bug#51657; Package guix-patches. (Sun, 07 Nov 2021 11:14:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Xinglu Chen <public <at> yoctocell.xyz>:
New bug report received and forwarded. Copy sent to ludo <at> gnu.org, andrew <at> trop.in, guix-patches <at> gnu.org. (Sun, 07 Nov 2021 11:14:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Xinglu Chen <public <at> yoctocell.xyz>
To: guix-patches <at> gnu.org
Subject: [PATCH] scripts: home: Make ‘guix home import’ populate ‘home-configuration.scm
Date: Sun, 07 Nov 2021 12:13:32 +0100
* 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 <ludo <at> gnu.org>
---
 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.
 
 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

base-commit: 1ffc0a6be3c1613b2d99ceea098174d1f11f6f3f
-- 
2.33.0







Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 17 Nov 2021 15:45:01 GMT) Full text and rfc822 format available.

Notification sent to Xinglu Chen <public <at> yoctocell.xyz>:
bug acknowledged by developer. (Wed, 17 Nov 2021 15:45:01 GMT) Full text and rfc822 format available.

Message #10 received at 51657-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Xinglu Chen <public <at> yoctocell.xyz>
Cc: 51657-done <at> debbugs.gnu.org, Andrew Tropin <andrew <at> trop.in>
Subject: Re: bug#51657: [PATCH] scripts: home: Make ‘guix home import’
 populate ‘home-configuration.scm
Date: Wed, 17 Nov 2021 16:44:42 +0100
[Message part 1 (text/plain, inline)]
Hello,

Xinglu Chen <public <at> yoctocell.xyz> skribis:

> * 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.

Applied with the changes below.  This is looking nice now!

Thanks!

Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/doc/guix.texi b/doc/guix.texi
index 5ce18fdf8a..59ceb4477a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -36673,7 +36673,7 @@ environment.  Note that not every home service that exists is supported
 
 @example
 $ guix home import ~/guix-config
-/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.
+guix home: '/home/alice/guix-config' populated with all the Home configuration files
 @end example
 
 @end table
diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm
index 118e66895e..afc7d8b39c 100644
--- a/guix/scripts/home.scm
+++ b/guix/scripts/home.scm
@@ -277,9 +277,12 @@ (define-syntax-rule (with-store* store exp ...)
        (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)))
+       (info (G_ "'~a' populated with all the Home configuration files~%")
+             destination)
+       (display-hint (format #f (G_ "\
+Run @command{guix home reconfigure ~a/home-configuration.scm} to effectively
+deploy the home environment described by these files.\n")
+                             destination))))
     ((describe)
      (match (generation-number %guix-home)
        (0

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 16 Dec 2021 12:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 93 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.