jellyfin: restartTriggers on webhook plugin so install runs at activation
The jellyfin-webhook-install oneshot has 'wantedBy = jellyfin.service', which only runs it when jellyfin (re)starts. On first rollout to a host where jellyfin is already running, the unit gets added but never fires, leaving the Webhook plugin files absent -- jellyfin-webhook-configure then gets 404 from /Plugins/$GUID/Configuration and deploy-rs rolls back. Pinning jellyfin.restartTriggers to the plugin package + install script forces a restart whenever either derivation changes, which pulls install in via the existing before/wantedBy chain.
This commit is contained in:
@@ -13,7 +13,13 @@ in
|
||||
lib.mkIf config.services.jellyfin.enable {
|
||||
# Materialise the Jellyfin Webhook plugin into Jellyfin's plugins dir before
|
||||
# Jellyfin starts. Jellyfin rewrites meta.json at runtime, so a read-only
|
||||
# nix-store symlink would EACCES — we copy instead.
|
||||
# nix-store symlink would EACCES -- we copy instead.
|
||||
#
|
||||
# `wantedBy = [ "jellyfin.service" ]` alone is insufficient on initial rollout:
|
||||
# if jellyfin is already running at activation time, systemd won't start the
|
||||
# oneshot until the next jellyfin restart. `restartTriggers` on jellyfin pinned
|
||||
# to the plugin package + install script forces that restart whenever either
|
||||
# changes, which invokes this unit via the `before`/`wantedBy` chain.
|
||||
systemd.services.jellyfin-webhook-install = {
|
||||
before = [ "jellyfin.service" ];
|
||||
wantedBy = [ "jellyfin.service" ];
|
||||
@@ -28,6 +34,13 @@ lib.mkIf config.services.jellyfin.enable {
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.jellyfin.restartTriggers = [
|
||||
webhookPlugin.package
|
||||
(webhookPlugin.mkInstallScript {
|
||||
pluginsDir = "${config.services.jellyfin.dataDir}/plugins";
|
||||
})
|
||||
];
|
||||
|
||||
# After Jellyfin starts, POST the plugin configuration so the webhook
|
||||
# targets the monitor's receiver. Idempotent; runs on every boot.
|
||||
systemd.services.jellyfin-webhook-configure = {
|
||||
|
||||
Reference in New Issue
Block a user