1 { pkgs, lib, config, hostName, ... }:
6 backup/rsync-backup.nix
8 # Take regular snapshots, and prune old ones
11 extraArgs = [ "--verbose" ];
13 "${hostName}/home" = {
22 "${hostName}/home/Documents" = {
31 "${hostName}/home/Downloads" = {
35 "${hostName}/home/Videos" = {
41 # Trigger backups when disks are plugged
42 services.udev.extraRules = ''
43 ACTION=="add", SUBSYSTEM=="block", KERNEL=="sd*", ENV{ID_SERIAL}=="WDC_WD10JPVT-22A1YT0_WD-WX21AC2F3987", ENV{SYSTEMD_WANTS}+="zfs-local-backup-home@WD10JPVT.service", ENV{SYSTEMD_ALIAS}="/sys/subsystem/usb/WD10JPVT"
44 # See https://github.com/systemd/systemd/issues/7587#issuecomment-381428545
45 ACTION=="remove", SUBSYSTEM=="block", KERNEL=="sd*", ENV{ID_SERIAL}=="WDC_WD10JPVT-22A1YT0_WD-WX21AC2F3987", TAG+="systemd"
47 ACTION=="add", SUBSYSTEM=="block", KERNEL=="sd*", ENV{ID_FS_LABEL}=="GE_SP", ENV{SYSTEMD_USER_WANTS}+="rsync-backup@GE_SP.service", ENV{SYSTEMD_ALIAS}="/sys/subsystem/usb/GE_SP"
48 ACTION=="remove", SUBSYSTEM=="block", KERNEL=="sd*", ENV{ID_FS_LABEL}=="GE_SP", TAG+="systemd"
50 programs.bash.shellAliases = {
51 mount-backup-WD10JPVT = "mount-zfs-backup WD10JPVT";