[PATCH 0/1] Avoid guix home reconfiguration when nothing is to be done.

  • Open
  • quality assurance status badge
Details
2 participants
  • Nicolas Graves
  • Richard Sent
Owner
unassigned
Submitted by
Nicolas Graves
Severity
normal

Debbugs page

Nicolas Graves wrote 9 months ago
(address . guix-patches@gnu.org)(address . ngraves@ngraves.fr)(address . andrew@trop.in)
20240627150643.30981-1-ngraves@ngraves.fr
While experimenting with profile reconfigurations almost a year ago, a
thing that happened a lot was that I reconfigured a lot while often I
didn't need to. In the event a guix system / guix home wrapper comes
to life (I've experimented for that in RDE), such a reflex to avoid
switching to new profiles that already are existing profiles is
welcome IMO.

This is not a definitive proposal but rather an illustration of an
approach which could be implemented at other places too to avoid some
unecessary calculations / reconfigurations.

Nicolas Graves (1):
guix: home: Avoid home reconfiguration when nothing is to be done.

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

--
2.45.2
Nicolas Graves wrote 9 months ago
[PATCH] guix: home: Avoid home reconfiguration when nothing is to be done.
(address . 71802@debbugs.gnu.org)(address . ngraves@ngraves.fr)(address . andrew@trop.in)
20240627153634.5181-1-ngraves@ngraves.fr
* 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(-)

Toggle diff (29 lines)
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
Richard Sent wrote 9 months ago
Re: [bug#71802] [PATCH 0/1] Avoid guix home reconfiguration when nothing is to be done.
(name . Nicolas Graves)(address . ngraves@ngraves.fr)(address . 71802@debbugs.gnu.org)(address . andrew@trop.in)
87bk3kv9mj.fsf@freakingpenguin.com
Hi Nicolas,

Toggle quote (11 lines)
> While experimenting with profile reconfigurations almost a year ago, a
> thing that happened a lot was that I reconfigured a lot while often I
> didn't need to. In the event a guix system / guix home wrapper comes
> to life (I've experimented for that in RDE), such a reflex to avoid
> switching to new profiles that already are existing profiles is
> welcome IMO.
>
> This is not a definitive proposal but rather an illustration of an
> approach which could be implemented at other places too to avoid some
> unecessary calculations / reconfigurations.

I can't figure out exactly how this patch could apply, but I can see it
or something similar being useful when using guix-home-service. If we
can make oneshot service attempt to register a new generation on every
invocation /and/ use a patch like to avoid redundant generations, it may
solve many of the issues raised in [1].


--
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 71802@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 71802
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help