3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/servers/jellyfin/default.nix

65 lines
2 KiB
Nix
Raw Normal View History

2020-03-09 23:54:59 +00:00
{ stdenv, lib, fetchurl, unzip, sqlite, makeWrapper, dotnetCorePackages, ffmpeg,
2020-04-13 11:47:26 +01:00
fontconfig, freetype, nixosTests }:
let
os = if stdenv.isDarwin then "osx" else "linux";
arch =
with stdenv.hostPlatform;
if isx86_32 then "x86"
else if isx86_64 then "x64"
else if isAarch32 then "arm"
else if isAarch64 then "arm64"
else lib.warn "Unsupported architecture, some image processing features might be unavailable" "unknown";
musl = lib.optionalString stdenv.hostPlatform.isMusl
(if (arch != "x64")
then lib.warn "Some image processing features might be unavailable for non x86-64 with Musl" "musl-"
else "musl-");
runtimeDir = "${os}-${musl}${arch}";
in stdenv.mkDerivation rec {
2019-03-07 21:22:37 +00:00
pname = "jellyfin";
2021-03-23 11:24:35 +00:00
version = "10.7.1";
2019-03-07 21:22:37 +00:00
# Impossible to build anything offline with dotnet
src = fetchurl {
2020-09-03 18:51:21 +01:00
url = "https://repo.jellyfin.org/releases/server/portable/versions/stable/combined/${version}/jellyfin_${version}.tar.gz";
2021-03-23 11:24:35 +00:00
sha256 = "sha256-pgFksZz0sD73uZDyUIhdFCgHPo67ZZiwklafyemJFGs=";
2019-03-07 21:22:37 +00:00
};
nativeBuildInputs = [
2019-03-07 21:22:37 +00:00
unzip
makeWrapper
];
propagatedBuildInputs = [
dotnetCorePackages.aspnetcore_5_0
2019-03-07 21:22:37 +00:00
sqlite
];
preferLocalBuild = true;
installPhase = ''
runHook preInstall
2019-03-07 21:22:37 +00:00
install -dm 755 "$out/opt/jellyfin"
cp -r * "$out/opt/jellyfin"
makeWrapper "${dotnetCorePackages.aspnetcore_5_0}/bin/dotnet" $out/bin/jellyfin \
2021-01-15 07:07:56 +00:00
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [
sqlite fontconfig freetype stdenv.cc.cc.lib
]}:$out/opt/jellyfin/runtimes/${runtimeDir}/native/" \
2019-04-21 11:04:47 +01:00
--add-flags "$out/opt/jellyfin/jellyfin.dll --ffmpeg ${ffmpeg}/bin/ffmpeg"
runHook postInstall
2019-03-07 21:22:37 +00:00
'';
2020-04-13 11:47:26 +01:00
passthru.tests = {
smoke-test = nixosTests.jellyfin;
};
2021-01-15 07:07:56 +00:00
meta = with lib; {
2019-03-07 21:22:37 +00:00
description = "The Free Software Media System";
homepage = "https://jellyfin.org/";
# https://github.com/jellyfin/jellyfin/issues/610#issuecomment-537625510
license = licenses.gpl2Plus;
2020-08-26 04:35:47 +01:00
maintainers = with maintainers; [ nyanloutre minijackson purcell ];
2019-03-07 21:22:37 +00:00
};
}