2024-03-26 11:26:06 -04:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
2024-04-04 08:57:19 -04:00
|
|
|
subsync,
|
2024-03-26 11:26:06 -04:00
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit (config.vars) mainUser;
|
|
|
|
|
2024-04-04 08:57:19 -04:00
|
|
|
subsyncPkg = subsync.packages.${pkgs.system}.default;
|
|
|
|
|
2024-03-26 11:31:59 -04:00
|
|
|
node-syncsub = pkgs.callPackage ./node-syncsub {
|
2024-04-04 08:57:19 -04:00
|
|
|
subsync = subsyncPkg;
|
2024-03-26 11:31:59 -04:00
|
|
|
};
|
2024-03-26 11:26:06 -04:00
|
|
|
in {
|
2024-04-04 08:57:19 -04:00
|
|
|
environment.systemPackages = [subsyncPkg node-syncsub];
|
2024-03-26 11:31:59 -04:00
|
|
|
|
2024-03-26 11:26:06 -04:00
|
|
|
systemd = {
|
|
|
|
services.subsync-job = {
|
|
|
|
serviceConfig = {
|
|
|
|
Type = "oneshot";
|
|
|
|
User = mainUser;
|
|
|
|
Group = config.users.users.${mainUser}.group;
|
|
|
|
};
|
|
|
|
|
2024-05-05 23:07:06 -04:00
|
|
|
path = [
|
|
|
|
pkgs.findutils
|
2024-03-26 11:31:59 -04:00
|
|
|
node-syncsub
|
2024-03-26 11:26:06 -04:00
|
|
|
];
|
|
|
|
|
|
|
|
script = ''
|
2024-04-08 19:48:57 -04:00
|
|
|
find /data/movies -name '*.mkv' -printf "%h\0" | xargs -0 -I '{}' node-syncsub '{}' "eng,fre"
|
|
|
|
# find /data/anime -name '*.mkv' -printf "%h\0" | xargs -0 -I '{}' node-syncsub '{}' "eng,fre"
|
|
|
|
# find /data/tv -name '*.mkv' -printf "%h\0" | xargs -0 -I '{}' node-syncsub '{}' "eng,fre"
|
2024-03-26 11:26:06 -04:00
|
|
|
'';
|
|
|
|
};
|
2024-04-04 08:57:19 -04:00
|
|
|
#timers.subsync-job = {
|
|
|
|
# wantedBy = ["timers.target"];
|
|
|
|
# partOf = ["subsync-job.service"];
|
|
|
|
# timerConfig.OnCalendar = ["0:00:00"];
|
|
|
|
#};
|
2024-03-26 11:26:06 -04:00
|
|
|
};
|
|
|
|
}
|