sub-sync turned into a path based executable

This commit is contained in:
Danilo Reyes 2024-09-03 01:43:30 -06:00
parent 24496c87b9
commit 0aaf692b4b

View File

@ -3,11 +3,22 @@ let
cfg = config.my.servers.jellyfin; cfg = config.my.servers.jellyfin;
sub-sync = pkgs.writeScriptBin "sub-sync" sub-sync = pkgs.writeScriptBin "sub-sync"
(builtins.readFile ../../scripts/sub-sync.sh); (builtins.readFile ../../scripts/sub-sync.sh);
sub-sync-path = [
pkgs.nix
pkgs.bash
pkgs.fd
pkgs.ripgrep
pkgs.file
pkgs.alass
pkgs.ffmpeg
pkgs.gum
sub-sync
];
in { in {
options.my.servers.jellyfin = setup.mkOptions "jellyfin" "flix" 8096; options.my.servers.jellyfin = setup.mkOptions "jellyfin" "flix" 8096;
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.jellyfin-ffmpeg ] environment.systemPackages = [ pkgs.jellyfin-ffmpeg ]
++ (if cfg.enableCron then [ sub-sync ] else [ ]); ++ (if cfg.enableCron then sub-sync-path else [ ]);
services = { services = {
jellyfin = { jellyfin = {
enable = true; enable = true;
@ -107,12 +118,12 @@ in {
restartIfChanged = true; restartIfChanged = true;
description = "syncronizes subtitles downloaded & modified today"; description = "syncronizes subtitles downloaded & modified today";
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
path = [ pkgs.nix sub-sync ]; path = sub-sync-path;
serviceConfig = { serviceConfig = {
Restart = "on-failure"; Restart = "on-failure";
RestartSec = 30; RestartSec = 30;
ExecStart = "${sub-sync}/bin/sub-sync all"; ExecStart = "${sub-sync}/bin/sub-sync all";
Type = "forking"; Type = "simple";
User = "root"; User = "root";
}; };
}; };