diff mbox series

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

Message ID 20240627153634.5181-1-ngraves@ngraves.fr
State New
Headers show
Series [bug#71802] guix: home: Avoid home reconfiguration when nothing is to be done. | expand

Commit Message

Nicolas Graves June 27, 2024, 3:36 p.m. UTC
* 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 mbox series

Patch

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