rpi4: add media sync systemd timer
This commit is contained in:
parent
2dccb28120
commit
74a9151823
hosts/rpi4
@ -10,6 +10,8 @@
|
||||
./hardware-configuration.nix
|
||||
./services.nix
|
||||
|
||||
./media-sync.nix
|
||||
|
||||
./backup.nix
|
||||
];
|
||||
|
||||
|
52
hosts/rpi4/media-sync.nix
Normal file
52
hosts/rpi4/media-sync.nix
Normal file
@ -0,0 +1,52 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
in {
|
||||
config = {
|
||||
nixfiles.programs.syncthing.enable = true;
|
||||
|
||||
|
||||
systemd.timers.gallery-dl = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnBootSec = "5m";
|
||||
OnUnitActiveSec = "13";
|
||||
RandomizedDelaySec = "4m";
|
||||
};
|
||||
};
|
||||
systemd.services.gallery-dl = {
|
||||
script = ''
|
||||
PATH=${with pkgs; lib.escapeShellArg (lib.makeBinPath [ bash coreutils findutils gallery-dl ])}
|
||||
export PATH
|
||||
|
||||
# none of your fucking business
|
||||
# TODO move this into an agenix secret probably
|
||||
exec /srv/gallery-dl.sh
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "nullbite";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.timers.gallery-dl-dedup = {
|
||||
wantedBy = [ "timers.target" ];
|
||||
timerConfig = {
|
||||
OnCalendar = "03:00";
|
||||
RandomizedDelaySec = "3h";
|
||||
};
|
||||
};
|
||||
systemd.services.gallery-dl-dedup = {
|
||||
script = ''
|
||||
PATH=${with pkgs; lib.escapeShellArg (lib.makeBinPath [ coreutils rmlint ])}
|
||||
export PATH
|
||||
|
||||
exec /srv/gallery-dl-dedup.sh
|
||||
'';
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "nullbite";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user