forked from mirrors/nixpkgs
Merge pull request #48150 from Vskilet/release-18.09
[18.09] nixos/emby: use the dataDir option
This commit is contained in:
commit
f80504e8fd
|
@ -36,11 +36,18 @@ in
|
|||
after = [ "network.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
preStart = ''
|
||||
test -d ${cfg.dataDir} || {
|
||||
echo "Creating initial Emby data directory in ${cfg.dataDir}"
|
||||
mkdir -p ${cfg.dataDir}
|
||||
chown -R ${cfg.user}:${cfg.group} ${cfg.dataDir}
|
||||
}
|
||||
if [ -d ${cfg.dataDir} ]
|
||||
then
|
||||
for plugin in ${cfg.dataDir}/plugins/*
|
||||
do
|
||||
echo "Correcting permissions of plugin: $plugin"
|
||||
chmod u+w $plugin
|
||||
done
|
||||
else
|
||||
echo "Creating initial Emby data directory in ${cfg.dataDir}"
|
||||
mkdir -p ${cfg.dataDir}
|
||||
chown -R ${cfg.user}:${cfg.group} ${cfg.dataDir}
|
||||
fi
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
|
@ -48,7 +55,7 @@ in
|
|||
User = cfg.user;
|
||||
Group = cfg.group;
|
||||
PermissionsStartOnly = "true";
|
||||
ExecStart = "${pkgs.emby}/bin/MediaBrowser.Server.Mono";
|
||||
ExecStart = "${pkgs.emby}/bin/emby -programdata ${cfg.dataDir}";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,44 +1,52 @@
|
|||
{ stdenv, fetchurl, pkgs, unzip, sqlite, makeWrapper, mono54, ffmpeg, ... }:
|
||||
{ stdenv, fetchurl, unzip, sqlite, makeWrapper, dotnet-sdk, ffmpeg }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "emby-${version}";
|
||||
version = "3.4.1.0";
|
||||
version = "3.5.3.0";
|
||||
|
||||
# We are fetching a binary here, however, a source build is possible.
|
||||
# See -> https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=emby-server-git#n43
|
||||
# Though in my attempt it failed with this error repeatedly
|
||||
# The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
|
||||
# This may also need msbuild (instead of xbuild) which isn't in nixpkgs
|
||||
# See -> https://github.com/NixOS/nixpkgs/issues/29817
|
||||
src = fetchurl {
|
||||
url = "https://github.com/MediaBrowser/Emby/releases/download/${version}/Emby.Mono.zip";
|
||||
sha256 = "08jr6v8xhmiwbby0lfvpjrlma280inwh5qp6v4p93lzd07fjynh5";
|
||||
url = "https://github.com/MediaBrowser/Emby.Releases/releases/download/${version}/embyserver-netcore_${version}.zip";
|
||||
sha256 = "0311af3q813cx0ykbdk9vkmnyqi2l8rx66jnvdkw927q6invnnpj";
|
||||
};
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
buildInputs = [
|
||||
unzip
|
||||
makeWrapper
|
||||
];
|
||||
propagatedBuildInputs = with pkgs; [
|
||||
mono54
|
||||
|
||||
propagatedBuildInputs = [
|
||||
dotnet-sdk
|
||||
sqlite
|
||||
];
|
||||
|
||||
# Need to set sourceRoot as unpacker will complain about multiple directory output
|
||||
sourceRoot = ".";
|
||||
preferLocalBuild = true;
|
||||
|
||||
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"
|
||||
rm -rf {electron,runtimes}
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp -r * $out/bin
|
||||
install -dm 755 "$out/opt/emby-server"
|
||||
cp -r * "$out/opt/emby-server"
|
||||
|
||||
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"
|
||||
makeWrapper "${dotnet-sdk}/bin/dotnet" $out/bin/emby \
|
||||
--prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [
|
||||
sqlite
|
||||
]}" \
|
||||
--add-flags "$out/opt/emby-server/EmbyServer.dll -ffmpeg ${ffmpeg}/bin/ffmpeg -ffprobe ${ffmpeg}/bin/ffprobe"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
meta = with stdenv.lib; {
|
||||
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;
|
||||
license = licenses.gpl2;
|
||||
maintainers = with maintainers; [ fadenb ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue