I'd like to run a service as a normal user but I am not entirely sure how, just running dinitctl as not root will just make it fail with:
dinit-client: connecting to socket /run/user/1000/dinitctl: No such file or directory
is it even possible?
Yes it is possible: https://github.com/Xynonners/dinit-userservd
Just follow the guide there, although I put "session optional pam_dinit_userservd.so" at the bottom of /etc/pam.d/system-login as per this reddit post: https://www.reddit.com/r/artixlinux/comments/wro58v/run_pipewire_as_a_dinit_service/
Works good, I use his pipewire services and made a little one for jackett. No issues so far.
Yup I also want to run pipewire that way.
However I already have dbus running as root from the normal configuration file, should I just disable dbus as root and just run it as a user? Or do I need to run both at the same time?
You need both.
https://en.wikipedia.org/wiki/D-Bus
Hi.
Dinit supports user services. You just need to prepare some files/directories.
I suggest read https://github.com/davmac314/dinit/blob/master/doc/getting_started.md as starting point.
Regards
If you do not opt for the userservd configuration, then you can do it by creating a user ran instance of dinit,
type = process
command = dinit -e <your-env-vars-dir>
smooth-recovery = true
logfile = /var/log/dinit/user-suite.log
waits-for = elogind
waits-for = tmpfs
run-as = <user>
Add this service to your dinit service files and enable it. Your user services may then be placed in ".config/dinit.d" (or wherever you want it to point to). Create a "boot.d" sub-directory and soft-link the services in the first directory to the boot.d directory for user service to start at boot.
Open to any suggestions to improve this.
Sorry to necro this after about two months, but are you still using this approach yourself? I tried to make use of it for my own scripts but it doesn't seem to work in this given set-up due to
XDG_RUNTIME_DIR not yet being present.
My apologies for the delay. If you have elogind enabled, then XDG_RUNTIME_DIR should be present for your own services. Currently, I am not using this approach (due to a reinstall recently). I see that you have taken a look at the tutorial for user services under dinit (reference (https://forum.artixlinux.org/index.php/topic,3268.0.html) for other users). That tutorial along with the script that I posted should work (it did when I tested it with pipewire/wireplumber).
The XDG_RUNTIME_DIR directory is only created when you log in. If you have a user instance of dinit spawned directly from the system instance, it will run before you have logged in, and the directory won't exist. This will likely cause issues and I advise against this approach for that reason. It's probably better just to run dinit (the user instance) from your login script. Even better still, use dinit-userservd/turnstile.