45 lines
1.1 KiB
Nix
45 lines
1.1 KiB
Nix
|
{ config, pkgs, ... }: {
|
||
|
# tarsnap periodic backup configuration
|
||
|
# {{{
|
||
|
launchd.agents.tarsnap =
|
||
|
let
|
||
|
logPath = "/var/log/tarsnap";
|
||
|
tarsnapBackup = pkgs.writeShellScriptBin "tarsnap-backup-helper" ''
|
||
|
/opt/homebrew/bin/tarsnap -v -c \
|
||
|
--configfile ${config.home.homeDirectory}/.tarsnaprc \
|
||
|
-f $(uname -n)-$(date -u +%Y-%m-%dT%H:%M:%SZ) \
|
||
|
${config.home.homeDirectory}/{dotfiles.nix,Desktop,Development,Documents,Downloads}
|
||
|
'';
|
||
|
in
|
||
|
{
|
||
|
enable = true;
|
||
|
config = {
|
||
|
Label = "com.tarsnap.tarsnap";
|
||
|
StandardErrorPath = "${logPath}/error.log";
|
||
|
StandardOutPath = "${logPath}/out.log";
|
||
|
StartCalendarInterval = [
|
||
|
{
|
||
|
# every sunday
|
||
|
Weekday = 0;
|
||
|
# at midnight
|
||
|
Hour = 0;
|
||
|
Minute = 0;
|
||
|
}
|
||
|
{
|
||
|
# every wednesday
|
||
|
Weekday = 3;
|
||
|
# at noon
|
||
|
Hour = 12;
|
||
|
Minute = 0;
|
||
|
}
|
||
|
];
|
||
|
Program = "${tarsnapBackup}/bin/tarsnap-backup-helper";
|
||
|
};
|
||
|
};
|
||
|
# }}}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|