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;
|
|
|
|
};
|
|
|
|
|
|
|
|
path = with pkgs; [
|
|
|
|
findutils
|
2024-03-26 11:31:59 -04:00
|
|
|
node-syncsub
|
2024-03-26 11:26:06 -04:00
|
|
|
];
|
|
|
|
|
|
|
|
script = ''
|
2024-04-01 18:40:15 -04:00
|
|
|
find /data/movies -name '*.mkv' -printf "%h\0" | xargs -0 -I '{}' node-syncsub '{}' "eng,fra"
|
|
|
|
# find /data/anime -name '*.mkv' -printf "%h\0" | xargs -0 -I '{}' node-syncsub '{}' "eng,fra"
|
|
|
|
# find /data/tv -name '*.mkv' -printf "%h\0" | xargs -0 -I '{}' node-syncsub '{}' "eng,fra"
|
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
|
|
|
};
|
|
|
|
}
|