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;
sub-sync = pkgs.writeScriptBin "sub-sync"
(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 {
options.my.servers.jellyfin = setup.mkOptions "jellyfin" "flix" 8096;
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.jellyfin-ffmpeg ]
++ (if cfg.enableCron then [ sub-sync ] else [ ]);
++ (if cfg.enableCron then sub-sync-path else [ ]);
services = {
jellyfin = {
enable = true;
@ -107,12 +118,12 @@ in {
restartIfChanged = true;
description = "syncronizes subtitles downloaded & modified today";
wantedBy = [ "default.target" ];
path = [ pkgs.nix sub-sync ];
path = sub-sync-path;
serviceConfig = {
Restart = "on-failure";
RestartSec = 30;
ExecStart = "${sub-sync}/bin/sub-sync all";
Type = "forking";
Type = "simple";
User = "root";
};
};