On 2021-09-15 12:09, Maxime Devos wrote: > Andrew Tropin schreef op wo 15-09-2021 om 11:47 [+0300]: >> *** Confusion >> I already mentioned that I see a lot of confusion between System and >> Shepherd services and I expect some confusion between home and system >> services, it will be especially true if we place them in the same >> namespace. >> >> People will be trying to use home services inside operating systems, >> #+begin_src scheme >> (operating-system >> (services >> (list (service home-mcron-service-type ...)))) >> #+end_src >> >> and configuration record for system services inside home services. >> #+begin_src scheme >> (home-environment >> ... (service home-mcron-service-type >> (mcron-configuration ...))) >> #+end_src > > What do you think of adding some validation code to 'service-type' > and the "guix home" equivalent, e.g. a ‘validate’ field, which > could be used like > > (define-module (...) > #:autoload (gnu home??? mcron) (mcron-user-configuration?)) > > (define mcron-service-type > (service-type (name 'mcron) > ... > (validate > (lambda (config) > (cond ((mcron-configuration? config) #t) > ((home-mcron-configuration? config) > ;; TODO: figure out a clear error message > (validation-error (G_ "A mcron configuration for > the system was expected, but a configuration for the user was used"))) > (#t #f)))))) > > and likewise for the "guix home" equivalent, such that if user configurations > are used in the system configuration, an error message is printed, indicating > the issue? Maybe include the line and column number of the record as well. > > Greetiings, > Maxime.
Hi Maxime, Nice idea and viable solution, but here I was talking about the case, when both home-mcron-service-type and mcron-service-type in the same (gnu services mcron) namespace. I expect much less confusion and it probably won't be an issue, when they are in different modules (gnu home-services mcron) and (gnu services mcron) for example. If person imports (gnu services SOMETHING) than they expect to get system services for their operating-system, if they imports (gnu home-services SOMETHING) they want to extend their home-environment.
signature.asc
Description: PGP signature