{ stdenv, fetchurl, pkgs, unzip, sqlite, makeWrapper, mono54, ffmpeg, ... }: stdenv.mkDerivation rec { name = "emby-${version}"; version = "3.4.1.0"; src = fetchurl { url = "https://github.com/MediaBrowser/Emby/releases/download/${version}/Emby.Mono.zip"; sha256 = "08jr6v8xhmiwbby0lfvpjrlma280inwh5qp6v4p93lzd07fjynh5"; }; buildInputs = with pkgs; [ unzip makeWrapper ]; propagatedBuildInputs = with pkgs; [ mono54 sqlite ]; # Need to set sourceRoot as unpacker will complain about multiple directory output sourceRoot = "."; buildPhase = '' substituteInPlace SQLitePCLRaw.provider.sqlite3.dll.config --replace libsqlite3.so ${sqlite.out}/lib/libsqlite3.so substituteInPlace MediaBrowser.Server.Mono.exe.config --replace ProgramData-Server "/var/lib/emby/ProgramData-Server" ''; installPhase = '' mkdir -p $out/bin cp -r * $out/bin makeWrapper "${mono54}/bin/mono" $out/bin/MediaBrowser.Server.Mono \ --add-flags "$out/bin/MediaBrowser.Server.Mono.exe -ffmpeg ${ffmpeg}/bin/ffmpeg -ffprobe ${ffmpeg}/bin/ffprobe" ''; meta = { description = "MediaBrowser - Bring together your videos, music, photos, and live television"; homepage = https://emby.media/; license = stdenv.lib.licenses.gpl2; maintainers = [ stdenv.lib.maintainers.fadenb ]; platforms = stdenv.lib.platforms.all; }; }