Subject: [bug#71802] [PATCH] guix: home: Avoid home reconfiguration when nothing is to be done.

From: Nicolas Graves <[email-masked]>
Date: Thu, 27 Jun 2024 17:36:18 +0200

* guix/scripts/home.scm (perform-action): In case of 'reconfigure
action, when the output profile is the current profile, avoid
reconfiguration.

Change-Id: I9d4413df05455a1ebbe10773a851a61e1c8c9e66
---
 guix/scripts/home.scm | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm
index b4c82d275f1..f0b8251c435 100644
--- a/guix/scripts/home.scm
+++ b/guix/scripts/home.scm
@@ -446,12 +446,16 @@ (define println
                      (generation (generation-file-name
                                   %guix-home (+ 1 number))))
 
-                (switch-symlinks generation he-out-path)
-                (switch-symlinks %guix-home generation)
-                (setenv "GUIX_NEW_HOME" he-out-path)
-                (primitive-load (string-append he-out-path "/activate"))
-                (setenv "GUIX_NEW_HOME" #f)
-                (return he-out-path)))
+                (if (equal? he-out-path (readlink* %guix-home))
+                    (begin (info (G_ "Nothing to be done.~%"))
+                           (return #f))
+                    (begin
+                      (switch-symlinks generation he-out-path)
+                      (switch-symlinks %guix-home generation)
+                      (setenv "GUIX_NEW_HOME" he-out-path)
+                      (primitive-load (string-append he-out-path "/activate"))
+                      (setenv "GUIX_NEW_HOME" #f)
+                      (return he-out-path)))))
              ((container)
               (mlet %store-monad ((status (spawn-home-container
                                            he
-- 
2.45.2