Add jellyfin

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-07-05 16:41:54 +01:00
parent e24997677d
commit bf49eac272
43 changed files with 1666 additions and 86 deletions

View File

@@ -14,6 +14,7 @@
docker-gitea = import ./docker/gitea { inherit pkgs; };
docker-grafana = import ./docker/grafana { inherit pkgs; };
docker-grafana-image-renderer = import ./docker/grafana-image-renderer { inherit pkgs; };
docker-jellyfin = import ./docker/jellyfin { inherit pkgs inputs system; };
docker-mariadb = import ./docker/mariadb { inherit pkgs; };
docker-nextcloud = import ./docker/nextcloud { inherit pkgs; };
docker-ntfy = import ./docker/ntfy { inherit pkgs; };
@@ -40,6 +41,14 @@
docker-whoami = import ./docker/whoami { inherit pkgs; };
docker-yq = import ./docker/yq { inherit pkgs; };
jellyfin-plugin-bookshelf = import ./jellyfin/plugins/bookshelf { inherit pkgs; };
jellyfin-plugin-intro-skipper = import ./jellyfin/plugins/intro-skipper { inherit pkgs; };
jellyfin-plugin-playbackreporting = import ./jellyfin/plugins/playbackreporting { inherit pkgs; };
jellyfin-plugin-reports = import ./jellyfin/plugins/reports { inherit pkgs; };
jellyfin-plugin-sso = import ./jellyfin/plugins/sso { inherit pkgs; };
jellyfin-plugin-subtitleextract = import ./jellyfin/plugins/subtitleextract { inherit pkgs; };
jellyfin-plugin-tvdb = import ./jellyfin/plugins/tvdb { inherit pkgs; };
linux-firmware-latest = import ./linux-firmware-latest { inherit pkgs; };
obsidian-plugin-better-word-count = import ./obsidian/plugins/better-word-count { inherit pkgs; };

View File

@@ -0,0 +1,108 @@
{
pkgs,
inputs,
system,
...
}:
let
selfPkgs = inputs.self.packages.${system};
jellyfin = pkgs.jellyfin.overrideAttrs (_: {
makeWrapperArgs = [
"--add-flags"
"--ffmpeg=${pkgs.jellyfin-ffmpeg}/bin/ffmpeg"
];
});
jellyfin-web = pkgs.runCommandLocal "jellyfin-web" { } ''
mkdir -p $out/var/www
cp -r ${pkgs.jellyfin-web}/share/jellyfin-web $out/var/www/jellyfin
'';
jellyfin-plugin-bookshelf = pkgs.runCommandLocal "jellyfin-plugin-bookshelf" { } ''
mkdir -p $out/var/lib/jellyfin/plugins
cp -r ${selfPkgs.jellyfin-plugin-bookshelf} $out/var/lib/jellyfin/plugins/bookshelf
'';
jellyfin-plugin-intro-skipper = pkgs.runCommandLocal "jellyfin-plugin-intro-skipper" { } ''
mkdir -p $out/var/lib/jellyfin/plugins
cp -r ${selfPkgs.jellyfin-plugin-intro-skipper} $out/var/lib/jellyfin/plugins/intro-skipper
'';
jellyfin-plugin-playbackreporting = pkgs.runCommandLocal "jellyfin-plugin-playbackreporting" { } ''
mkdir -p $out/var/lib/jellyfin/plugins
cp -r ${selfPkgs.jellyfin-plugin-playbackreporting} $out/var/lib/jellyfin/plugins/playbackreporting
'';
jellyfin-plugin-reports = pkgs.runCommandLocal "jellyfin-plugin-reports" { } ''
mkdir -p $out/var/lib/jellyfin/plugins
cp -r ${selfPkgs.jellyfin-plugin-reports} $out/var/lib/jellyfin/plugins/reports
'';
jellyfin-plugin-sso = pkgs.runCommandLocal "jellyfin-plugin-sso" { } ''
mkdir -p $out/var/lib/jellyfin/plugins
cp -r ${selfPkgs.jellyfin-plugin-sso} $out/var/lib/jellyfin/plugins/sso
'';
jellyfin-plugin-subtitleextract = pkgs.runCommandLocal "jellyfin-plugin-subtitleextract" { } ''
mkdir -p $out/var/lib/jellyfin/plugins
cp -r ${selfPkgs.jellyfin-plugin-subtitleextract} $out/var/lib/jellyfin/plugins/subtitleextract
'';
jellyfin-plugin-tvdb = pkgs.runCommandLocal "jellyfin-plugin-tvdb" { } ''
mkdir -p $out/var/lib/jellyfin/plugins
cp -r ${selfPkgs.jellyfin-plugin-tvdb} $out/var/lib/jellyfin/plugins/tvdb
'';
entrypoint = pkgs.writeTextFile {
name = "entrypoint";
executable = true;
destination = "/bin/entrypoint";
text = builtins.readFile ./entrypoint.sh;
};
in
pkgs.dockerTools.buildImage {
name = "jellyfin";
fromImage = import ../base { inherit pkgs; };
copyToRoot = pkgs.buildEnv {
name = "root";
paths = [
entrypoint
jellyfin
jellyfin-web
jellyfin-plugin-bookshelf
jellyfin-plugin-intro-skipper
jellyfin-plugin-playbackreporting
jellyfin-plugin-reports
jellyfin-plugin-sso
jellyfin-plugin-subtitleextract
jellyfin-plugin-tvdb
pkgs.jellyfin-ffmpeg
pkgs.curl
pkgs.jq
];
pathsToLink = [
"/bin"
"/lib"
"/var"
];
};
runAsRoot = ''
${pkgs.dockerTools.shadowSetup}
'';
config = {
Entrypoint = [ "entrypoint" ];
ExposedPorts = {
"8096/tcp" = { };
};
Volumes = {
"/etc/jellyfin" = { };
"/var/lib/jellyfin" = { };
"/var/log/jellyfin" = { };
"/tmp/jellyfin" = { };
};
};
}

View File

@@ -0,0 +1,39 @@
#!/usr/bin/env sh
set -o errexit
set -o nounset
start() {
jellyfin \
-w /var/www/jellyfin \
-c /etc/jellyfin \
-d /var/lib/jellyfin \
-l /var/log/jellyfin \
-C /tmp/jellyfin \
"$@" &
PID=$!
}
start "$@"
JELLYFIN_HOST="${JELLYFIN_HOST:-http://localhost:8096}"
JELLYFIN_ADMIN_USERNAME="${JELLYFIN_ADMIN_USERNAME:-admin}"
until setup="$(curl -sf --retry 10 --retry-connrefused "$JELLYFIN_HOST/System/Info/Public" | jq -r '.StartupWizardCompleted' 2>/dev/null)"; do
echo "Waiting for Jellyfin to be ready..."
sleep 1
done
if [ "$setup" = "false" ] && [ -f /etc/jellyfin/setup.sh ]; then
# shellcheck disable=SC1091
. /etc/jellyfin/setup.sh
kill "$PID"
wait "$PID" 2>/dev/null || true
start "$@"
fi
trap 'kill -INT "$PID"' INT TERM
wait "$PID"
exit $?

View File

@@ -26,24 +26,10 @@ if [ ! -f "/var/www/nextcloud/config/config.php" ]; then
--admin-pass "$ADMIN_PASS" \
--data-dir "/var/lib/nextcloud"
occ user:delete admin
occ app:disable \
app_api \
contactsinteraction \
dashboard \
federation \
firstrunwizard \
photos \
recommendations \
sharebymail \
support \
survey_client \
user_status \
weather_status
occ app:install \
oidc_login
if [ -f /etc/nextcloud/post-setup.sh ]; then
# shellcheck disable=SC1091
. /etc/nextcloud/post-setup.sh
fi
fi
occ upgrade
@@ -58,8 +44,6 @@ occ maintenance:repair --include-expensive
occ background:cron
occ maintenance:update:htaccess
[ -n "${EXTRA_INIT:-}" ] && eval "$EXTRA_INIT"
cron
PHPRC="$(dirname "$(readlink -f "$(which php)")")/../lib/php.ini"

View File

@@ -1,8 +1,9 @@
#!/usr/bin/env sh
set -o errexit
set -o nounset
if [ -n "$SHLINK_SERVER_URL" ] && [ -n "$SHLINK_SERVER_API_KEY" ]; then
if [ -n "${SHLINK_SERVER_URL:-}" ] && [ -n "${SHLINK_SERVER_API_KEY:-}" ]; then
SHLINK_SERVER_NAME="${SHLINK_SERVER_NAME:-Shlink}"
SHLINK_SERVER_FORWARD_CREDENTIALS="${SHLINK_SERVER_FORWARD_CREDENTIALS:-false}"
echo "[{\"name\":\"${SHLINK_SERVER_NAME}\",\"url\":\"${SHLINK_SERVER_URL}\",\"apiKey\":\"${SHLINK_SERVER_API_KEY}\",\"forwardCredentials\":${SHLINK_SERVER_FORWARD_CREDENTIALS}}]" > /var/www/shlink-web-client/servers.json

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env sh
set -o errexit
set -o nounset
mkdir -p \
/var/www/shlink/data/cache \
@@ -14,15 +15,15 @@ INITIAL_API_KEY=$(/var/www/shlink/bin/cli env-var:read INITIAL_API_KEY)
init_flags="--no-interaction --clear-db-cache"
if [ -z "${GEOLITE_LICENSE_KEY}" ] || [ "${SKIP_INITIAL_GEOLITE_DOWNLOAD}" = "true" ]; then
init_flags="${init_flags} --skip-download-geolite"
if [ -z "${GEOLITE_LICENSE_KEY:-}" ] || [ "${SKIP_INITIAL_GEOLITE_DOWNLOAD:-}" = "true" ]; then
init_flags="$init_flags --skip-download-geolite"
fi
if [ -n "${INITIAL_API_KEY}" ]; then
init_flags="${init_flags} --initial-api-key=${INITIAL_API_KEY}"
if [ -n "${INITIAL_API_KEY:-}" ]; then
init_flags="$init_flags --initial-api-key=$INITIAL_API_KEY"
fi
# shellcheck disable=SC2086
php /var/www/shlink/vendor/bin/shlink-installer init ${init_flags}
php /var/www/shlink/vendor/bin/shlink-installer init $init_flags
exec rr serve -c /var/www/shlink/config/roadrunner/.rr.yml "$@"

View File

@@ -0,0 +1,16 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake jellyfin-plugin-bookshelf
pkgs.stdenv.mkDerivation rec {
pname = "bookshelf";
version = "12";
src = pkgs.fetchzip {
url = "https://github.com/jellyfin/jellyfin-plugin-bookshelf/releases/download/v${version}/bookshelf_${version}.0.0.0.zip";
sha256 = "sha256-P85SLXaJuFIv9AmAE6mPbxZDMBhqEt+88dZiPUKu2iQ=";
stripRoot = false;
};
installPhase = ''
cp -r $src $out
'';
}

View File

@@ -0,0 +1,22 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake jellyfin-plugin-intro-skipper
pkgs.stdenv.mkDerivation rec {
pname = "intro-skipper";
version = "1.10.10.20";
src =
let
parts = pkgs.lib.strings.splitString "." version;
major = pkgs.lib.lists.take 2 (pkgs.lib.lists.drop 1 parts);
merged = pkgs.lib.strings.concatStringsSep "." major;
in
pkgs.fetchzip {
url = "https://github.com/intro-skipper/intro-skipper/releases/download/${merged}/v${version}/intro-skipper-v${version}.zip";
sha256 = "sha256-RlrZkE8108Uj5V90+jw2o5fXb+K+9/hoDcEaSkKLDGg=";
stripRoot = false;
};
installPhase = ''
cp -r $src $out
'';
}

View File

@@ -0,0 +1,16 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake jellyfin-plugin-playbackreporting
pkgs.stdenv.mkDerivation rec {
pname = "playbackreporting";
version = "16";
src = pkgs.fetchzip {
url = "https://github.com/jellyfin/jellyfin-plugin-playbackreporting/releases/download/v${version}/playback-reporting_${version}.0.0.0.zip";
sha256 = "sha256-UrWxS0CpeeW4nYNyRNxnK0jqiAqXwfLv3YfFokfVH0A=";
stripRoot = false;
};
installPhase = ''
cp -r $src $out
'';
}

View File

@@ -0,0 +1,16 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake jellyfin-plugin-reports
pkgs.stdenv.mkDerivation rec {
pname = "reports";
version = "17";
src = pkgs.fetchzip {
url = "https://github.com/jellyfin/jellyfin-plugin-reports/releases/download/v${version}/reports_${version}.0.0.0.zip";
sha256 = "sha256-kN1UDhx5/1sw3PO5co2YkfbZNiDj56F2YAT8S/0EdZM=";
stripRoot = false;
};
installPhase = ''
cp -r $src $out
'';
}

View File

@@ -0,0 +1,16 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake jellyfin-plugin-sso
pkgs.stdenv.mkDerivation rec {
pname = "sso";
version = "3.5.2.4";
src = pkgs.fetchzip {
url = "https://github.com/9p4/jellyfin-plugin-sso/releases/download/v${version}/sso-authentication_${version}.zip";
sha256 = "sha256-e+w5m6/7vRAynStDj34eBexfCIEgDJ09huHzi5gQEbo=";
stripRoot = false;
};
installPhase = ''
cp -r $src $out
'';
}

View File

@@ -0,0 +1,16 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake jellyfin-plugin-subtitleextract
pkgs.stdenv.mkDerivation rec {
pname = "subtitleextract";
version = "4";
src = pkgs.fetchzip {
url = "https://github.com/jellyfin/jellyfin-plugin-subtitleextract/releases/download/v${version}/subtitle-extract_${version}.0.0.0.zip";
sha256 = "sha256-FstPWUYsZg416DNshIV4yOvbg6U21cRxKse8hITUyBY=";
stripRoot = false;
};
installPhase = ''
cp -r $src $out
'';
}

View File

@@ -0,0 +1,16 @@
{ pkgs, ... }:
# AUTO-UPDATE: nix-update --flake jellyfin-plugin-tvdb
pkgs.stdenv.mkDerivation rec {
pname = "tvdb";
version = "19";
src = pkgs.fetchzip {
url = "https://github.com/jellyfin/jellyfin-plugin-tvdb/releases/download/v${version}/thetvdb_${version}.0.0.0.zip";
sha256 = "sha256-011wpVwQy562XDAwAQ44GJTbu/ESHcyo5F/wrtNBAcs=";
stripRoot = false;
};
installPhase = ''
cp -r $src $out
'';
}