services: Prepare repo for runit user services

This commit is contained in:
Marty Oehme 2025-02-25 18:12:21 +01:00
parent 9270ec64bd
commit ea1bd6c573
Signed by: Marty
GPG key ID: 4E535BC19C61886E
2 changed files with 40 additions and 5 deletions
.dotter
services

View file

@ -66,6 +66,7 @@ office = "~"
"services/README.md" = { target = "~/NOWHERE", type = "symbolic", if = "false" }
# FIXME: Disabling existing systemd services for the moment
"services/systemd" = { target = "~/NOWHERE", type = "symbolic", if = "false" }
"services/sv" = { target = "~/.config/sv", type = "symbolic"}
services = "~"
[social.files]

View file

@ -1,6 +1,40 @@
# User services
This module uses `systemd` to provide various services for the user running the dotfiles.
This module provides two sub-directories with services at the moment:
- `systemd` to provide various services running under a system-d service supervision manager.
- and `sv` to provide services running under a runit (i.e. daemontool) service supervision manager.
## runit
Services residing in the `sv` directory are created to run under a [runit](https://smarden.org/runit/) service manager.
They are, essentially, directories with a single `run` executable script (usually bash) which is executed by runit.
Generally they also tend to have a `log` subdirectory with its own `run` executable script which will create a logging process for the respective service.
To learn more about _runit_, consult the page linked above or a guide such as [this](https://kchard.github.io/runit-quickstart/).
On my current system, aside from system processes (`dbus`, `acpid`, `chrony`, `polkit`, etc.),
there is a `turnstile` service which enables starting and supervising user-specific services.
These are the services to be found in the `sv` directory, and they take care of setting up a usable wayland environment for the user.
Such an environment contains a compositor, clipboard managemnt, wallpaper display, statusbar, user `dbus` session, audio, and more.
On cloning the dotfiles these services are by default _not_ activated currently,
though they can be activated all at once with the following command:
```sh
ln -s ~/.config/sv/* ~/.local/state/service/
```
## systemd
The systemd services are left here as a legacy documentation of previously used services,
should the need arise to make use of them again.
None of them are currently running in any production environment.
Please be aware that the following documentation is years old (most of it stems from 2020),
and wildly out of date for my current machine setup.
The services will get moved into the correct `.config` directory for `systemd` to pick them up as user services.
They are, for now, *automatically* enabled when installing the dotfiles. This is pending changes.
@ -18,7 +52,7 @@ In other words:
you will **very likely** not just want to install and activate this module in general but be picky about what to do with it,
since it conforms to a highly opinionated set of installed applications and directory structures.
## Why systemd
### Why systemd
There are two reasons for the service module making use of `systemd` to manage its services:
@ -37,7 +71,7 @@ So what that essentially means: this service module uses `systemd` *for now*.
It might change to something else in the future.
It might also not be written very well, since I am using it to adopt a mental mapping of `systemd` at the same time.
## Drop-in Changes to services
### Drop-in Changes to services
There are, for now, small changes to the services that get installed by default with their arch packages: `greenclip` and `redshift`.
Both need a running X server for their program to start successfully, and both are repeatedly run way too fast by systemd by default and would crash.
@ -46,7 +80,7 @@ I have not yet created a new target solely for X having started
so in the meantime these changes simply make the programs wait longer before trying to restart.
This generally gives ample time for the services to start correctly by themselves.
## Commit Notes service
### Commit Notes service
This service `uni-notes-sync.service` keeps my university note directory in sync with a remote origin.
The script behind it (`git-sync`) can be used more generally to keep any git directory in sync.
@ -60,7 +94,7 @@ In effect this means, using the default values, the service will commit any chan
The two cycles can be changed independently from each other via the environment variables mentioned above so that, for example, the repository can be pushed every single time a commit takes place, or commits can be checked for on faster or shorter intervals.
As another example, if you want to check for changes every 30 seconds but still push every hour, you would do `GS_TIME_TO_COMMIT=30` and `GS_UNCHANGED_RUNS_TO_PUSH=120`.
## Dropdown services
### Dropdown services
The `dropdown-terminal.service` is very simple, and always keeps a terminal window running.
The program is started with a `scratchpad` class, which is picked up by [`i3`](i3) and automatically hidden.