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 SUBSYSTEM=="block", KERNEL=="sd*", ENV{ID_SERIAL}=="WDC_WD10JPVT-22A1YT0_WD-WX21AC2F3987", \
44 ACTION=="add", ENV{SYSTEMD_WANTS}+="zfs-local-backup-home@WD10JPVT.service"
45 # See https://github.com/systemd/systemd/issues/7587#issuecomment-381428545
46 SUBSYSTEM=="block", KERNEL=="sd*", ENV{ID_SERIAL}=="WDC_WD10JPVT-22A1YT0_WD-WX21AC2F3987", \
47 ACTION=="remove", RUN+="${pkgs.systemd}/bin/systemctl stop --no-block zfs-local-backup-home@WD10JPVT.service"
49 SUBSYSTEM=="block", KERNEL=="sd*", ENV{ID_FS_LABEL}=="GE_SP", \
50 ACTION=="add", ENV{SYSTEMD_USER_WANTS}+="rsync-backup@GE_SP.service"
51 SUBSYSTEM=="block", KERNEL=="sd*", ENV{ID_FS_LABEL}=="GE_SP", \
52 ACTION=="remove", RUN+="${pkgs.systemd}/bin/systemctl stop --no-block zfs-import@off3.service"
54 programs.bash.shellAliases = {
55 mount-backup-WD10JPVT = "mount-zfs-backup WD10JPVT";