mirror of
https://github.com/oqyude/nixos.git
synced 2026-06-15 22:41:52 +03:00
123
This commit is contained in:
@@ -1,19 +1,26 @@
|
|||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
services = {
|
services = {
|
||||||
tailscale.enable = config.xlib.device.type != "wsl"; # true, if not wsl
|
tailscale.enable = config.xlib.device.type != "wsl"; # true, if not wsl
|
||||||
|
};
|
||||||
systemd = {
|
systemd = {
|
||||||
services.rsync-archive = lib.mkIf (config.xlib.device.type == "server") {
|
services.rsync-archive = lib.mkIf (config.xlib.device.type == "server") {
|
||||||
description = "Backup data using rsync";
|
description = "Backup data using rsync";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
requiresMountsFor = [ config.xlib.dirs.archive-drive ];
|
requisite = [ "mnt-archive.mount" ]; # hard-code
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
#ExecStartPre = "/bin/sh -c 'if ! mountpoint -q ${config.xlib.dirs.archive-drive}; then exit 1; fi'";
|
User = "root";
|
||||||
ExecStart = "${pkgs.rsync}/bin/rsync -av --delete ${config.xlib.dirs.immich-folder} ${config.xlib.dirs.archive-drive}/Services/immich";
|
Group = "root";
|
||||||
|
ExecStart = ''
|
||||||
|
${pkgs.rsync}/bin/rsync -rtv --delete ${config.xlib.dirs.immich-folder}/ ${config.xlib.dirs.archive-drive}/Services/immich/
|
||||||
|
${pkgs.rsync}/bin/rsync -rtv --delete ${config.xlib.dirs.nextcloud-folder}/ ${config.xlib.dirs.archive-drive}/Services/nextcloud/
|
||||||
|
'';
|
||||||
Nice = 19;
|
Nice = 19;
|
||||||
IOSchedulingClass = "idle";
|
IOSchedulingClass = "idle";
|
||||||
};
|
};
|
||||||
@@ -24,7 +31,7 @@
|
|||||||
timerConfig = {
|
timerConfig = {
|
||||||
OnCalendar = "weekly";
|
OnCalendar = "weekly";
|
||||||
Persistent = true;
|
Persistent = true;
|
||||||
};
|
Unit = "rsync-archive.service";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user