Home : Make services switch-independent.

This commit is contained in:
Dmitry Voronin 2024-05-10 20:34:15 +03:00
parent 0fd72bc32c
commit 6236a8e65b
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
6 changed files with 17 additions and 13 deletions

View file

@ -74,7 +74,7 @@
echo "Backup : Complete ''${bupsize}."
'';
in {
systemd.services.backup = {
systemd.services.backup = util.mkStaticSystemdService {
enable = true;
description = "Home system backup.";
serviceConfig = {

View file

@ -4,7 +4,7 @@
docker exec -u 33 cloud php -f /var/www/html/cron.php || notify 'Nextcloud : Failed to run cron.'
'';
in {
systemd.services.nextcloud = {
systemd.services.nextcloud = util.mkStaticSystemdService {
enable = true;
description = "Nextcloud worker.";
serviceConfig = {

View file

@ -1,11 +1,11 @@
{ pkgs, ... }: let
{ pkgs, util, ... }: let
script = ''
in="/storage/hot/docker/cloud/data/data/cakee/files/media/photo/"
out="/storage/cold_1/backup/tmp/photo/"
docker run --rm -v "''${in}":/in -v "''${out}":/out voronind.com/photoprocess:latest
'';
in {
systemd.services.photos_process = {
systemd.services.photos_process = util.mkStaticSystemdService {
enable = true;
description = "Process uploaded photos.";
serviceConfig = {

View file

@ -1,10 +1,10 @@
{ pkgs, ... }: let
{ pkgs, util, ... }: let
script = ''
music="/storage/hot/media/music/"
docker run --rm -v "''${music}":/music voronind.com/yamusic:latest
'';
in {
systemd.services.yandex_music = {
systemd.services.yandex_music = util.mkStaticSystemdService {
enable = true;
description = "Sync music from Yandex.Music.";
serviceConfig = {

View file

@ -1,11 +1,8 @@
{ const, pkgs, lib, secret, ... }: {
systemd.services.autoupdate = {
{ const, pkgs, lib, secret, util, ... }: {
systemd.services.autoupdate = util.mkStaticSystemdService {
enable = true;
description = "Signed system auto-update.";
restartIfChanged = false;
serviceConfig.Type = "oneshot";
stopIfChanged = false;
unitConfig.X-StopOnRemoval = false;
path = with pkgs; [
bash
git

View file

@ -14,4 +14,11 @@
catText = files: args: builtins.foldl' (acc: mod:
acc + trimTabs ((import mod args).text)
) "" files;
# Systemd service that does not restart with system switch.
mkStaticSystemdService = params: params // {
restartIfChanged = false;
stopIfChanged = false;
unitConfig.X-StopOnRemoval = false;
};
}