From: Pierre Neidhardt <mail@ambrevar.xyz>
To: Guix-devel <guix-devel@gnu.org>
Cc: alex.ter.weele@gmail.com, "Ludovic Courtès" <ludovic.courtes@inria.fr>
Subject: Guix shepherd user services
Date: Sun, 10 Feb 2019 16:02:05 +0100 [thread overview]
Message-ID: <87bm3j4rgy.fsf@ambrevar.xyz> (raw)
[-- Attachment #1: Type: text/plain, Size: 4752 bytes --]
I've been thinking about shepherd user services.
We just had a discussion on the topic:
https://lists.gnu.org/archive/html/help-guix/2019-02/msg00010.html
and an interesting patch was sent a while ago:
https://lists.gnu.org/archive/html/guix-devel/2018-02/msg00047.html.
Jelle first introduced me to this idea during the Guix days and it took
me a while to understand why it's pure awesomeness. In short: just like
we can fully configure an operating-system in Guile and we don't have to
touch /etc manually, we could do the same with our user profile. At
last, done with .bashrc / .profile to start user daemons, cron jobs,
whatever synchronization script you use...
It would also make it possible to fully _initialize_ a user profile (just like
we initialize the operating-system) with the desired files. For instance, a
service could synchronize git repositories (e.g. your dotfiles), deploy it,
synchronize your emails, generate the mlocate cache, snapshot some btrfs drives,
you name it.
As a result, on a Guix install it would be possible to run
guix service --install -f my-services.scm
let the magic happen, relog(?) et enjoy a 100% pre-configured user
profile. How cool is that?
Benefits over traditional dotfiles or cron jobs:
- No more need for .xinitrc, .local/bin, etc.
- Declarative and uniformly programmable in Guile.
- Every service is uniformly controllable (start, restart, stop, status, etc.).
It's not so convenient to do that with a daemon that was started from .xinitrc.
- Drags non-propagated inputs automatically, no need to polute the user profile
(e.g. with redshift, xcape, etc.)
- Pre-configured services to choose from, as provided by Guix (unlike mcron).
My thoughts regarding the implementation design:
- Services can be enabled, disabled, started, restarted, stopped, listed,
they can show details and documentation, they can run pre-defined actions.
They are semantically very different from packages (in fact they often use
packages, but not always). I don't think it would be good to mix and match
services and packages in a command like `guix package --list-installer`. So I
suggest we keep them separate.
- The user must be able to build and install services. We could have the
following behaviour then:
`guix service --build redshift` would produce a
/gnu/store/...-shepherd-redshit.scm
`guix service --install redshift` would install it to ~/.guix-profile/services/redshift.scm.
`guix service --remove redshift` would remove it from the above location.
`guix service --upgrade=redshift` would rebuilt the service (and maybe
redshift) and install the new version.
- How do we write custom services? Well, just like we write custom packages and
custom operating-system, in a channel or in GUIX_PACKAGE_PATH (which name
becomes less and less meaningful).
- How do we update services (e.g. the redshift service when the redshift package
just got updated)? My understanding is that services are citizens similar to
operating system declarations: they depend on the current Guix version and the
user-defined definitions (e.g. channels).
Then `guix pull && guix service --upgrade` will do.
- How do we start the user shepherd on login and load the service configuration?
We need to be cautious to support foreign distributions. On GuixSD, we could
arrange /etc/profile to run
shepherd --config ~/.guix-profile/service-manifest.scm
on login. On foreign distributions, users can add the above command to
~/.profile, or ~/.bashrc, etc.
- If the package manifest and the service manifest are separate, it follows that
we now have 2 parameters to "reproducibly" define a user profile. I think
that's fine and it allows for composition (mix and match service manifests and
package manifests).
- Currently I think it's not possible to just define shepherd services without
enabling them. Thus it's not possible to have a list of available services
just like we have a list of packages. While this might be OK for the system
(but is it?), I think it would be nice if, as a user, we could do a
guix service --list-available
and pick services from there. This is somewhat a separate issue but
it would be nice to solve it. I don't know enough about the shepherd
internals to go into the details here.
- Should Guix drive the services with a `guix service` subcommand or should we
leave it to `herd` run by the user? Since we use `herd` for system services,
I think it's more consistent to stick to `herd`.
I'd like to work on it with anyone interesting on the topic. I know
some people I've worked on it before, so feel free to share your
progress :)
--
Pierre Neidhardt
https://ambrevar.xyz/
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
next reply other threads:[~2019-02-10 15:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-10 15:02 Pierre Neidhardt [this message]
2019-02-10 17:21 ` Guix shepherd user services Gábor Boskovits
2019-02-10 18:22 ` Pierre Neidhardt
-- strict thread matches above, loose matches on Subject: below --
2019-04-29 19:57 Tanguy Le Carrour
2019-04-29 20:10 ` Tobias Geerinckx-Rice
2019-05-01 9:00 ` Tanguy Le Carrour
2019-05-04 7:07 ` Tanguy Le Carrour
2019-05-04 11:45 ` Tobias Geerinckx-Rice
2019-05-08 7:30 ` Tanguy Le Carrour
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=87bm3j4rgy.fsf@ambrevar.xyz \
--to=mail@ambrevar.xyz \
--cc=alex.ter.weele@gmail.com \
--cc=guix-devel@gnu.org \
--cc=ludovic.courtes@inria.fr \
/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).