1{
2 lib,
3 stdenv,
4 fetchurl,
5 makeWrapper,
6 libzen,
7 libmediainfo,
8 jdk17,
9}:
10
11stdenv.mkDerivation rec {
12 pname = "ums";
13 version = "13.2.1";
14
15 src =
16 let
17 selectSystem =
18 attrs:
19 attrs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
20 arch = selectSystem {
21 x86_64-linux = "x86_64";
22 aarch64-linux = "arm64";
23 };
24 in
25 fetchurl {
26 url = "mirror://sourceforge/project/unimediaserver/${version}/UMS-${version}-${arch}.tgz";
27 hash = selectSystem {
28 x86_64-linux = "sha256-MGi5S0jA9WVh7PuNei5hInUVZLcypJu8izwWJpDi42s=";
29 aarch64-linux = "sha256-9x1M1rZxwg65RdMmxQ2geeF0yXrukQ3dQPXKfQ2GRIw=";
30 };
31 };
32
33 nativeBuildInputs = [ makeWrapper ];
34
35 installPhase = ''
36 runHook preInstall
37
38 cp -a . $out
39 mkdir $out/bin
40 mv $out/documentation /$out/doc
41
42 # ums >= 9.0.0 ships its own JRE in the package. if we remove it, the `UMS.sh`
43 # script will correctly fall back to the JRE specified by JAVA_HOME
44 rm -rf $out/jre17
45
46 makeWrapper $out/UMS.sh $out/bin/ums \
47 --prefix LD_LIBRARY_PATH : ${
48 lib.makeLibraryPath [
49 libzen
50 libmediainfo
51 ]
52 } \
53 --set JAVA_HOME ${jdk17}
54
55 runHook postInstall
56 '';
57
58 meta = {
59 description = "Universal Media Server: a DLNA-compliant UPnP Media Server";
60 license = lib.licenses.gpl2Only;
61 platforms = lib.platforms.linux;
62 maintainers = with lib.maintainers; [
63 thall
64 snicket2100
65 ];
66 mainProgram = "ums";
67 };
68}