guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple profiles with Guix Home


From: Andrew Tropin
Subject: Re: Multiple profiles with Guix Home
Date: Wed, 25 May 2022 14:01:22 +0300

On 2022-05-24 20:31, Liliana Marie Prikler wrote:

> Hi,
>
> Am Dienstag, dem 24.05.2022 um 14:55 +0300 schrieb Andrew Tropin:
>> On 2022-05-23 19:05, Liliana Marie Prikler wrote:
>> > [...]
>> > I don't think I agree with this choice.  To satisfy both my own use
>> > case of serving profiles in different locations from another and
>> > another issue being raised w.r.t. configuring the location of the
>> > .guix-home profile, I think we should make a triple of location,
>> > optional short name, and manifest (which may be generated from
>> > packages implicitly).  WDYT?
>> > 
>> 
>> This service is intended for profiles managed by Guix Home, so every
>> profile MUST be a part of home-environment (~/.guix-home is a symlink
>> to it).  I don't see any meaningful reasons to make it possible to
>> customize the path inside home-environment.
> Why though?  The decision to restrict Guix Home to dotfiles was already
> a bad one that has since been overturned, so I think we should
> carefully evaluate why "~/.guix-home" even is special.  In my point of
> view, any path that is prefixed with the user's home ought to be fair
> game, as should be constructing intermediate per-user profile symlinks
> in /var/guix.

It's not bad, it had and has its own goals, pros and cons, I found
another design descision, which we think is more intuitive, but still
partially serving original goals and we switched to it.  The disucssion
about ~/.guix-home symlink itself is unrelated to both "dotfiles
question" and my original statement.

All dot/xdg/other files belong to home-environment and no side-effects
are done during the build of home-environment, the only side-effects
happens during activation and $HOME touched only by symlink-manager and
I would like to keep it to be the case, otherwise we will end up with
tons of stateful ad-hoc hacks.

That said, I would like to avoid any Guix Home logic to rely on paths
outside of home-environment.  In case you really need
~/work/my-project/guix-profile to be created for some reason you can
extend home-files-service-type and rely on symlink-manager to do this
dirty job, but the setup-environment script will still source
home-environment/profiles/your-profile-name and won't know anything
about ~/work/my-project/guix-profile.

>> If you want to have profiles like ~/work/my-project/guix-profile or
>> ~/.guix/profiles/my-python-environment managed by Guix Home you can
>> implement home-external-profiles-service-type, which can extended
>> activation service or any other impure tricks, but I would advice
>> against it.  I suggest either manage a profile with
>> home-[additional-]-profiles or manage them externally and load with
>> home-profile-paths/home-profile-loader.
> Pardon me if I was confusing, but I meant to have one service defining
> the existence of ~/work/my-project/guix-profile (that being home-
> profiles-service-type) and another to load it (that being home-profile-
> loader-service-type).  Admittedly, the existing way of specifying a
> profile that is loaded becomes more work then, so perhaps we can add
> some syntactic sugar to that, so that both services get extended at
> once.
>
>> > Considering the above, I think a rough roadmap would be:
>> > 1. Implementing home-profiles-service-type (to build the profiles)
>> > 2. Implementing home-profile-loader-service-type
>> 
>> This one looks simplier and also independent from #1, so I would
>> recommend to start with it.  Also, it's very likely that
>> home-profiles-service-type will be extending
>> home-profile-loader-service-type
> I thought about it for some while, but I really don't think either is
> easier than the other, particularly in the way I described it, where
> home-profiles-service-type and home-profile-loader-service-type are
> orthogonal to each other.
>
>> > 3. ???
>> > 4. Deprecate the existing home-profile-service-type in favor of the
>> > new profile service type pair and/or implement it in terms of it.
>> > where (1) and (2) could be done by two people/teams in parallel.
>> 
>> The migration should be quite simple here.
>> 
>> JFYI: The design of Guix Home is flexible, essential services can be
>> completely customized, even symlink-manager can be removed or
>> substituted with something else (for example to make a read-only home
>> workflow proposed by Julien Lepiller in guix-home-manager).  This is
>> also used in rde to substitute home-shell-profile-service-type with
>> alternative implementation:
>> https://git.sr.ht/~abcdw/rde/tree/master/item/rde/features.scm#L234
> I'm not sure if I'm that fond of this design choice – it reminds me a
> bit about OOP horrors I was forced to learn.  Anyway, I don't think
> it's relevant, as...
>> This way you can experiment with multi-profile approach even without
>> modifying existing code.
> I was planning to run guix home from checkout with $HOME in /tmp anyway
> for testing purposes.
>
>> > Given that the task has been simplified, I think I might start
>> > coding on it, but I can't promise any particular deadline.  At the
>> > moments both my day job and review work delay any other
>> > contributions towards Guix.
>> > 
>> > Cheers
>> 
>> I also advice to treat it as an experiment.  IMO Guix Home should be
>> relatively conservative, stable and simple.  Other advanced workflows
>> in most cases should be implemented and maintained separately and be
>> optionally pluggable in Guix Home by overriding essential services or
>> any other way.  In cases such workflows demonstrates their benifits
>> without compromising simplicity, they can be included.
> I initially planned for the new stuff to be backwards compatible by way
> of sanitizers.  That probably still works for the design we have
> currently, though YMMV.

Let's get some initial implementation done and will continue the
discussion on more real-life examples.

-- 
Best regards,
Andrew Tropin

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]