diff --git a/configurations/server.nix b/configurations/server.nix index 9833cb6..7e3fc68 100644 --- a/configurations/server.nix +++ b/configurations/server.nix @@ -62,7 +62,7 @@ let ]; }; # Mobile SD-Card - "/mnt/mobile-sd" = { + "/mnt/mobile" = { device = "/dev/disk/by-uuid/7EB1-DC99"; fsType = "exfat"; options = [ diff --git a/modules/options.nix b/modules/options.nix index 4107f5c..7008602 100644 --- a/modules/options.nix +++ b/modules/options.nix @@ -46,6 +46,11 @@ default = "/mnt/archive"; description = "Archive drive mount point."; }; + mobile-drive = lib.mkOption { + type = lib.types.str; + default = "/mnt/mobile"; + description = "Mobile drive mount point."; + }; therima-drive = lib.mkOption { type = lib.types.str; default = "/mnt/therima"; diff --git a/modules/server/systemd.nix b/modules/server/systemd.nix index f2a8348..9390f5a 100644 --- a/modules/server/systemd.nix +++ b/modules/server/systemd.nix @@ -7,30 +7,57 @@ }: { systemd = { - services.rsync-archive = { - # Archivesta - # Make copy of files - description = "Backup data using rsync"; - #after = [ ]; - requisite = [ "mnt-archive.mount" ]; # hard-code - script = '' - ${pkgs.rsync}/bin/rsync -rtv --delete ${xlib.dirs.services-folder}/ ${xlib.dirs.archive-drive}/Services/ - ''; - serviceConfig = { - Type = "oneshot"; - User = "root"; - Group = "root"; - Nice = 19; - IOSchedulingClass = "idle"; + services = { + rsync-archivesta = { + # Archivesta + description = "Backup data using rsync"; + requisite = [ "mnt-archive.mount" ]; # hard-code + script = '' + ${pkgs.rsync}/bin/rsync -rtv --delete ${xlib.dirs.services-folder}/ ${xlib.dirs.archive-drive}/Services/ + ''; + serviceConfig = { + Type = "oneshot"; + User = "root"; + Group = "root"; + Nice = 19; + IOSchedulingClass = "idle"; + }; + }; + rsync-archivesta-lite = { + # Archivesta Lite + description = "Backup data using rsync"; + requisite = [ "mnt-mobile.mount" ]; # hard-code + script = '' + ${pkgs.rsync}/bin/rsync -rtv --delete ${xlib.dirs.services-folder}/ ${xlib.dirs.mobile-drive}/ + ${pkgs.rsync}/bin/rsync -rtv --delete ${xlib.dirs.services-folder}/ ${xlib.dirs.mobile-drive}/ + ''; + serviceConfig = { + Type = "oneshot"; + User = "root"; + Group = "root"; + Nice = 19; + IOSchedulingClass = "idle"; + }; }; }; - timers.rsync-archive = { - description = "Run rsync backup weekly"; - wantedBy = [ "timers.target" ]; - timerConfig = { - OnCalendar = "daily"; - Persistent = true; - Unit = "rsync-archive.service"; + timers = { + rsync-archivesta = { + description = "Run rsync backup daily"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "daily"; + Persistent = true; + Unit = "rsync-archive.service"; + }; + }; + rsync-archivesta-lite = { + description = "Run rsync backup weekly"; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "weekly"; + Persistent = true; + Unit = "rsync-archive.service"; + }; }; }; };