unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michal Atlas <michal_atlas+gnu@posteo.net>
To: guix-devel@gnu.org
Subject: On Extensions and Features
Date: Tue, 23 Jan 2024 00:33:30 +0000	[thread overview]
Message-ID: <da2ef384-554a-7cc2-b0aa-a8978397b395@posteo.net> (raw)

Hello Guix,

There have been a few mentions of rde features on here but were 
generally skimmed over, still I think
there's an interesting idea here.

They seem to address a few things, allowing a changing set of services 
based on the arguments,
coupling home and system and
passing around configuration inside the service system.

The last one gnawed at me until I realized that services do sensibly 
have a one way
flow of extensions forming a DAG, but the extension can be made only 
from one side.
There isn't really a way for a service to force another service to 
extend it.

This is scheme so obviously one could forcefully mutate or inherit and 
substitute, but this
starts to break down quick when we wish to combine services
from different channels and risks collisions and replacing a lot of 
service-types.

So the general idea could be to have the reverse extensions listed (hooks),
and their values passed to the extension procedures.

something like:

#+BEGIN_SRC scheme
(service-type
   (name 'home-bash)
   (extensions (list (service-extension home-xdg-data-service-type
                       (lambda (config alias-value) ...))))
   (hooks (list home-alias-service-type))
   ...)
#+END_SRC

Since when one wants to switch out their shell, or have multiple,
this'd allow them all to take the output of one canonical service that 
provides the alist of aliases the user wants.
(obviously questionable if one wants to generally do that but it could 
be toggleable)
Same could apply to user-information in guix home, keyboard preferences,
a web frontend to a service automatically knowing what port the backend 
runs on,
creating some kind of internal users of a program mirroring the system ones,
firewall rules, or whatever else.
Or, if one didn't require the service to exist and it returned #f in 
such a case,
then for example podman could link a docker compatibility binary iff it 
didn't find docker on the system.

Yes, it could easily be argued that my examples are quite dubious,
but it's just a random idea I wanted opinions on.

And since this is being in a sense replicated by features,
it'd be a nice way of merging a part of them upstream without opinionation,
and users might eventually find more and more actual uses for it,
with services making more educated decisions based on the system at hand,
and users won't have to implement something of the same sort in userspace.

It is undeniably a change towards much more expressive services
and it should be non-disruptive to existing code which defaults to 
"reverse-extending" no services.
fold-services would need a rework other than that I think it'd be 
straightforward.
(which is obviously easier said than done).

The question is how high/low-level the interface to services should be,
since a lot can be done with a few LETs and λs if services are supposed 
to be dead simple,
but such an approach makes it harder to build up well interacting services.

So that was just a very immature idea of what could be a nice to have in 
Guix.

Cheers



                 reply	other threads:[~2024-01-23  0:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=da2ef384-554a-7cc2-b0aa-a8978397b395@posteo.net \
    --to=michal_atlas+gnu@posteo.net \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).