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/Downloads" = {
26 "${hostName}/home/Videos" = {
32 # Trigger backups when disks are plugged
33 services.udev.extraRules = ''
34 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"
35 # See https://github.com/systemd/systemd/issues/7587#issuecomment-381428545
36 ACTION=="remove", SUBSYSTEM=="block", KERNEL=="sd*", ENV{ID_SERIAL}=="WDC_WD10JPVT-22A1YT0_WD-WX21AC2F3987", TAG+="systemd"
38 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"
39 ACTION=="remove", SUBSYSTEM=="block", KERNEL=="sd*", ENV{ID_FS_LABEL}=="GE_SP", TAG+="systemd"
41 programs.bash.shellAliases = {
42 mount-backup-WD10JPVT = "mount-zfs-backup WD10JPVT";