nixos-configs/devices/nos/modules/subtitles/subsync/default.nix
matt1432 7c9af8ebdd
All checks were successful
Discord / discord commits (push) Has been skipped
feat(subtitles): package sc0ty/subsync
2024-03-25 19:54:40 -04:00

45 lines
1.1 KiB
Nix

{
config,
pkgs,
...
}: let
inherit (config.vars) mainUser;
sphinxbase = pkgs.callPackage ./sphinxbase.nix {};
pocketsphinx = pkgs.callPackage ./pocketsphinx.nix {inherit sphinxbase;};
subsync = pkgs.callPackage ./subsync.nix {inherit sphinxbase pocketsphinx;};
in {
systemd = {
services.subsync-job = {
serviceConfig = {
Type = "oneshot";
User = mainUser;
Group = config.users.users.${mainUser}.group;
};
path = with pkgs; [
findutils
subsync
(writeShellApplication {
name = "sync-sub";
runtimeInputs = [subsync];
text = ''
# TODO: sync on a specific file
# $1 = file path
'';
})
];
script = ''
find /data/anime -name '*.srt' -exec sync-sub "{}" \;
find /data/movies -name '*.srt' -exec sync-sub "{}" \;
find /data/tv -name '*.srt' -exec sync-sub "{}" \;
'';
};
timers.subsync-job = {
wantedBy = ["timers.target"];
partOf = ["subsync-job.service"];
timerConfig.OnCalendar = ["0:00:00"];
};
};
}