On 2025-04-24 11:35, Rutherther wrote: > Hi, > > On April 23, 2025 10:38:44 PM GMT+02:00, "Ludovic Courtès" <l...@gnu.org> > wrote: >>Hi, >> >>Rutherther <ruthert...@ditigal.xyz> writes: >> >>> was there any discussion about conditional service extensions? >> >>Not that I know of. >> >>> Sometimes, I would like to extend a different service only based on the >>> configuration from user, but it's not possible. Any service extension >>> brings the >>> service in the service tree, and that is sometimes unwarranted, in cases >>> where something is just an optional dependency. >> >>One can usually extend a service in a way that is a no-op, so it’s okay >>to extend unconditionally, but I agree it’s not pretty. >> > > The problem is that the service is now in the tree if wasn't before. That is > usually what you want, but not always. > > For example shell integrations like starship (<https://starship.rs/>) or > direnv (<https://direnv.net/docs/hook.html>) have a per-shell configuration. > You can't extend all the shells unconditionally because that will bring their > config in home even if you didn't want any. You could make a function where > you say what shell service or services to extend, but that is also not ideal. > Because now you have a problem if you wanted to extend this service - the > type depends on the configuration. > > Or am I just missing something?
In RDE we solve it with features (built on top of guix services): https://git.sr.ht/~abcdw/rde/tree/bfe0605f/src/rde/features/shellutils.scm#L142 direnv configuration for zsh will be added to zsh service only when zsh is present in the rde config at all. You can read more on this topic (lack of polymorphic behavior of services): https://lists.sr.ht/~abcdw/rde-devel/%3c87sg56g97i....@trop.in%3E However, even current RDE's features meachanism is not perfect and we are aware of a few limitations/inconviniences imposed by it, so we plan to migrate to more advanced approach based on propagator networks in the future. -- Best regards, Andrew Tropin
signature.asc
Description: PGP signature