nixos-configs/devices/nos/modules/subtitles/syncing.nix

53 lines
1.2 KiB
Nix
Raw Normal View History

{
bazarr-bulk,
config,
lib,
pkgs,
2024-04-04 08:57:19 -04:00
subsync,
...
}: let
inherit (config.vars) mainUser;
2024-04-04 08:57:19 -04:00
subsyncPkg = subsync.packages.${pkgs.system}.default;
bbPkg = bazarr-bulk.packages.${pkgs.system}.default;
2024-04-04 08:57:19 -04:00
node-syncsub = pkgs.callPackage ./node-syncsub {
2024-04-04 08:57:19 -04:00
subsync = subsyncPkg;
};
in {
environment.systemPackages = [
(pkgs.writeShellApplication {
name = "bb";
text = ''
exec ${lib.getExe bbPkg} --config ${config.sops.secrets.bazarr-bulk.path} "$@"
'';
})
];
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
node-syncsub
];
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-04-04 08:57:19 -04:00
#timers.subsync-job = {
# wantedBy = ["timers.target"];
# partOf = ["subsync-job.service"];
# timerConfig.OnCalendar = ["0:00:00"];
#};
};
}