Continuing this tutorial series on service files, today we’ll look at a simple, comparable way to make “user services” available in Nitrux. OpenRC did not have a concept of “user services” as defined by Systemd, “systemd offers users the ability to manage services under the user’s control with a per-user systemd instance, enabling users to start, stop, enable, and disable their own units“.
While OpenRC now supports user services starting with version 0.60, we’ll do so in a much simpler, rootless way.
Difficulty: ★☆☆☆☆
Services as a User
Most users are familiar with the system-wide services managed by the init-system; think of your packaged Docker daemon or the PulseAudio server. Regular services on Nitrux are usually located in /etc/init.d and run with root privileges. These services have one thing in common: once enabled, they start and stop with the system boot and shut down, depending on their runlevel.
But a “service” can be made for and entirely controlled by regular unprivileged users. Usually, to achieve this functionality, we’d use a standard XDG path ($XDG_CONFIG_HOME/autostart); however, since Nitrux 5.0.0, we’ve been using Hyprland, which works differently in this regard.
Instead of adding a desktop launcher to the mentioned directory as we’d do for other desktops, like Plasma, we only add the executable we want to autostart to the configuration file in ~/.config/hypr/hyprland.conf, like this:
################# ### AUTOSTART ### ################# # Autostart necessary processes (like notifications daemons, status bars, etc.) # Or execute your favorite apps at launch like this: exec-once = waybar
Once we log out and log in, the executable will run when the session starts.
That’s it; this concludes today’s tutorial and this series about user services in Nitrux.
