Original commit
This commit is contained in:
commit
cc74263a3b
26 changed files with 3052 additions and 0 deletions
60
modules/servermodules/jellyfin/jellyfin.nix
Normal file
60
modules/servermodules/jellyfin/jellyfin.nix
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
exporter-pkg,
|
||||
...
|
||||
}:
|
||||
{
|
||||
environment.systemPackages = [
|
||||
pkgs.jellyfin
|
||||
pkgs.jellyfin-web
|
||||
pkgs.jellyfin-ffmpeg
|
||||
];
|
||||
|
||||
services.jellyfin = {
|
||||
enable = true;
|
||||
configDir = "/jellyfin/config";
|
||||
dataDir = "/jellyfin/data";
|
||||
};
|
||||
|
||||
age.secrets.jellyfin-key = {
|
||||
file = ./secrets/jellyfin-key;
|
||||
owner = "jellyfin";
|
||||
};
|
||||
|
||||
# Define the systemd service
|
||||
systemd.services.jellyfin-exporter = {
|
||||
description = "Jellyfin Exporter for Prometheus";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [
|
||||
"network-online.target"
|
||||
"run-agenix.d.mount"
|
||||
]; # Should start after network is up
|
||||
wants = [
|
||||
"network-online.target"
|
||||
"run-agenix.d.mount"
|
||||
]; # Should start after network is up
|
||||
|
||||
serviceConfig = {
|
||||
# The command to start the exporter
|
||||
# You MUST replace the placeholders below with your actual data
|
||||
ExecStart = ''
|
||||
/bin/sh -c "${exporter-pkg}/bin/jellyfin_exporter \
|
||||
--jellyfin.address=http://localhost:8096 \
|
||||
--jellyfin.token=$(cat ${config.age.secrets.jellyfin-key.path})"
|
||||
'';
|
||||
|
||||
# Run the service as the user we created
|
||||
User = "jellyfin";
|
||||
|
||||
# Automatically restart the service if it fails
|
||||
Restart = "on-failure";
|
||||
RestartSec = "5s";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"L+ /data/movies - - - - /mnt/volume-hel1-1/movies"
|
||||
"L+ /data/series - - - - /mnt/volume-hel1-1/series"
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue