mirror of
https://github.com/oqyude/nixos.git
synced 2026-06-10 20:20:41 +03:00
123
This commit is contained in:
@@ -8,31 +8,4 @@
|
||||
services = {
|
||||
tailscale.enable = config.xlib.device.type != "wsl"; # true, if not wsl
|
||||
};
|
||||
systemd = {
|
||||
services.rsync-archive = lib.mkIf (config.xlib.device.type == "server") {
|
||||
description = "Backup data using rsync";
|
||||
#after = [ ];
|
||||
requisite = [ "mnt-archive.mount" ]; # hard-code
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
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;
|
||||
IOSchedulingClass = "idle";
|
||||
};
|
||||
};
|
||||
timers.rsync-archive = lib.mkIf (config.xlib.device.type == "server") {
|
||||
description = "Run rsync backup weekly";
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = "weekly";
|
||||
Persistent = true;
|
||||
Unit = "rsync-archive.service";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -14,5 +14,6 @@
|
||||
./nginx.nix
|
||||
./stirling-pdf.nix
|
||||
./zerotier.nix
|
||||
./systemd.nix
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
systemd = {
|
||||
services.rsync-archive = { # Make copy of files
|
||||
description = "Backup data using rsync";
|
||||
#after = [ ];
|
||||
requisite = [ "mnt-archive.mount" ]; # hard-code
|
||||
script = ''
|
||||
${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/
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "root";
|
||||
Group = "root";
|
||||
# ExecStart = ''
|
||||
# '';
|
||||
Nice = 19;
|
||||
IOSchedulingClass = "idle";
|
||||
};
|
||||
};
|
||||
timers.rsync-archive = {
|
||||
description = "Run rsync backup weekly";
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = "daily";
|
||||
Persistent = true;
|
||||
Unit = "rsync-archive.service";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user