2021-04-24 13:43:46 +02:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchurl
|
|
|
|
, nixosTests
|
|
|
|
, stdenv
|
|
|
|
, dotnetCorePackages
|
2022-03-28 10:48:16 +02:00
|
|
|
, buildDotnetModule
|
2021-04-24 13:43:46 +02:00
|
|
|
, ffmpeg
|
|
|
|
, fontconfig
|
|
|
|
, freetype
|
|
|
|
, jellyfin-web
|
|
|
|
, sqlite
|
|
|
|
}:
|
2019-05-18 12:11:19 +02:00
|
|
|
|
|
|
|
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
|
2021-04-27 15:52:15 +02:00
|
|
|
(lib.warnIf (arch != "x64") "Some image processing features might be unavailable for non x86-64 with Musl"
|
|
|
|
"musl-");
|
2021-04-24 13:43:46 +02:00
|
|
|
# https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#using-rids
|
|
|
|
runtimeId = "${os}-${musl}${arch}";
|
|
|
|
in
|
2022-03-28 10:48:16 +02:00
|
|
|
buildDotnetModule rec {
|
2019-03-07 22:22:37 +01:00
|
|
|
pname = "jellyfin";
|
2022-06-27 06:39:08 +02:00
|
|
|
version = "10.8.1"; # ensure that jellyfin-web has matching version
|
2019-03-07 22:22:37 +01:00
|
|
|
|
2021-04-24 13:43:46 +02:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jellyfin";
|
|
|
|
repo = "jellyfin";
|
|
|
|
rev = "v${version}";
|
2022-06-27 06:39:08 +02:00
|
|
|
sha256 = "8XkE0rDvuBcNTsWFf+JtqRuhjhfkbNT8qPSdfuA9DXI=";
|
2019-03-07 22:22:37 +01:00
|
|
|
};
|
|
|
|
|
2022-03-28 10:48:16 +02:00
|
|
|
patches = [
|
|
|
|
# when building some warnings are reported as error and fail the build.
|
|
|
|
./disable-warnings.patch
|
2019-03-07 22:22:37 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
sqlite
|
|
|
|
];
|
|
|
|
|
2022-03-28 10:48:16 +02:00
|
|
|
projectFile = "Jellyfin.Server/Jellyfin.Server.csproj";
|
|
|
|
executables = [ "jellyfin" ];
|
|
|
|
nugetDeps = ./nuget-deps.nix;
|
|
|
|
runtimeDeps = [
|
|
|
|
ffmpeg
|
|
|
|
fontconfig
|
|
|
|
freetype
|
|
|
|
];
|
|
|
|
dotnet-sdk = dotnetCorePackages.sdk_6_0;
|
|
|
|
dotnet-runtime = dotnetCorePackages.aspnetcore_6_0;
|
|
|
|
dotnetFlags = [ "--runtime=${runtimeId}" ];
|
|
|
|
dotnetBuildFlags = [ "--no-self-contained" ];
|
|
|
|
|
|
|
|
preInstall = ''
|
|
|
|
makeWrapperArgs+=(
|
|
|
|
--add-flags "--ffmpeg ${ffmpeg}/bin/ffmpeg"
|
2021-04-24 13:43:46 +02:00
|
|
|
--add-flags "--webdir ${jellyfin-web}/share/jellyfin-web"
|
2022-03-28 10:48:16 +02:00
|
|
|
)
|
2019-03-07 22:22:37 +01:00
|
|
|
'';
|
|
|
|
|
2020-04-13 12:47:26 +02:00
|
|
|
passthru.tests = {
|
|
|
|
smoke-test = nixosTests.jellyfin;
|
|
|
|
};
|
|
|
|
|
2021-04-24 13:43:46 +02:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
|
|
|
meta = with lib; {
|
2019-03-07 22:22:37 +01:00
|
|
|
description = "The Free Software Media System";
|
2020-08-15 06:31:02 +02:00
|
|
|
homepage = "https://jellyfin.org/";
|
2021-03-11 23:55:04 +01:00
|
|
|
# https://github.com/jellyfin/jellyfin/issues/610#issuecomment-537625510
|
|
|
|
license = licenses.gpl2Plus;
|
2021-04-24 13:43:46 +02:00
|
|
|
maintainers = with maintainers; [ nyanloutre minijackson purcell jojosch ];
|
2022-03-28 10:48:16 +02:00
|
|
|
platforms = dotnet-runtime.meta.platforms;
|
2019-03-07 22:22:37 +01:00
|
|
|
};
|
|
|
|
}
|