On 2022-02-01 10:15, Ludovic Courtès wrote: > Hi Andrew, > > We’re drifting away from the practical issue of adding a Redshift > service, but you raise interesting issues. That's true, but a few first home services will set the tone for the rest, so it's probably a good idea to look ahead right now, then later. > > Andrew Tropin skribis: > > [...] > >>> Yes, that’s the usual tradeoff. The choice made so far in Guix has been >>> to choose clarity over faithfulness to upstream’s name choices. >>> >> >> Maybe I'm wrong, but it's very likely that most of the users will be >> checking out upstream documentation anyway during configuration of some >> programs and those renamings will bring a lot of confusion and >> especially, when the record fields names will be combined with names in >> escape hatches. > > I think there doesn’t have to be a single answer. For Redshift and its > handful of options, I see little incentive to go look at ‘man redshift’; > it doesn’t add much to what we provide. > > For more complex services, the answer might be different, although again > the Dovecot service shows that, even for this big a service, we can > provide comprehensive bindings and associated documentation. > > [...] > >>> I can see the appeal of alists, but the choice made in Guix is to use >>> records for configuration; that has advantages, such as type checking, >>> detection of incorrect field names, and the ability to use all the bells >>> and whistles of (guix records). >> >> Type checks are possible with data structure driven approach as well and >> in a fact it's much more flexible and powerful, however to be fair it >> will require some work to prepare a good framework for that like >> https://github.com/plumatic/schema >> or >> https://github.com/metosin/spec-tools/blob/master/docs/02_data_specs.md >> for Clojure. >> >> It's also possible to generate documentation for such specs. >> >> Potentially, such approach is more powerful. > > I’m aware of Clojure specs, but I don’t find it convincing compared to > records, at least for our use case. > Ok. >>>> It would be good to extend home-files-service-type with config-file >>>> generated above and home-profile-service-type with the value of >>>> `redshift` field. >>> >>> Regarding the former, that’s not something we usually do for system >>> services. >> >> Imagine terminal or almost any other user space program > > I’m not imagining: we’re discussing a very concrete service here. :-) > > For Redshift, I don’t see the point of making the config available > globally. For system services, there’s only a handful of exception (PAM > and OpenSSH come to mind, but see /etc). > > Again, there doesn’t have to be a single answer. I suspect many > services won’t need to make their config available under ~/.config, but > if some do, so be it. I’d say that the default should be to not make > config available unless that’s required, just like what we do for system > services. > > How does that sound? It sounds logical for redshift, but inconsistent in general: some home services install package to profile, some not, some create config in XDG_CONFIG_DIR, some not. I still think that almost all services must provide both package and configs. >>> As for the latter, I thought about it but I’m not sure what it would be >>> used for. WDYT? >>> >> >> It can be used for debugging, for man pages or when redshift don't use >> shepherd service and started in different way (by wm for example). > > The point of this Redshift service is to have it started automatically, > so to me the only reason to add ‘redshift’ to the user profile would be > to allow ‘man redshift’. > > I don’t view it as super useful in this case, and would instead lean on > the side of not “polluting” the user’s profile, but I can very well > imagine that in other cases we’d prefer to extend the user’s profile. > >>> I understand your concerns, but I think they’re beyond the scope of this >>> review. I also think that there’s ample experience with system services >>> showing that writing “nice” configuration bindings actually works in >>> practice. >> >> I saw how well-written, but macros-based solutions in Clojure ecosystem >> slowly died and substituted with data-based. I understand that Guile >> ecosystem has a slightly weaker toolkit for processing datastructures, >> but by the end of the day I think we will be here sooner or later. >> Using macros instead of datastructures feels for me like remaking the > > Records are data structures, not macros. > But, IIRC, define-configuration, define-record-type are. >> same mistake again knowing the consequences. Maybe I'm wrong. > > Maybe one of us is wrong, or maybe it’s more complex than this. :-) Also, maybe my non-guile experience doesn't apply here. > > As it turns out, I find Guix’s configuration records rather nice to > use—much nicer than, for example, Gnus’ loose configuration trees. Unfortunately, I'm not familiar with Gnus internals and can't say if it's related, similar or not. -- Best regards, Andrew Tropin