On Thu, Dec 28, 2023 at 8:43 PM Csepp <raingl...@riseup.net> wrote: > Ben Weinstein-Raun <r...@benwr.net> writes: > > > Hello! I'm fairly new to using Guix System, and I have a lot of > > questions.
So am I, so do I. > > One is: Is it possible to run a shepherd user service at system > > start, rather than at login? > > > > My guess is that this is at least possible, by defining a > > system-level service that starts a shepherd for each user. Would > > that work? > > > > Anyone have tips on how to go about building this, if so? I'll let others reply on behalf of Guix and Shepherd. What I'll add is a reinforcement of your idea, but which drifts apart from the Guix system. You can use Daniel J. Bernstein's daemontools http://cr.yp.to/daemontools.html, which is already packaged in Guix --- guix install daemontools. You can write a service for Shepherd to start daemontool's svscan and now you can manage all your services outside Shepherd, including user's services --- so long as you complement the system in one small way. With svscan starting at boot, letting users run their own services at boot as well is a matter of writing a program with the setuid-bit so that it is able to create symbolic links in the directory monitored by svscan (say, /service) --- enabling the user's service to be managed by svscan. That would accomplish what you ask. Many system administrators will not let users create as many services as they want. You need to answer these questions. Say you'd like to allow users to have up to a few services --- tprogram-idea above could control that by counting how many the users has already used. Here's what the user would go through to install his service: $ mkdir ~/my-service $ emacs ~/my-service/run $ chmod 0755 ~/my-service/run Say the program-idea above is called ``create-service''. Then $ create-service user-x-service-1 ~/my-service creates a symbolic link /service/user-x-service-1 --> /home/x/my-service The daemontool's svscan program will start the run script within a few seconds. From then on, the user can use daemontools to monitor his service at ~/my-service.