stackpkgs/packages/audiorelay.nix

98 lines
2.5 KiB
Nix
Raw Normal View History

2024-07-17 19:14:44 +02:00
{
lib,
stdenv,
fetchzip,
makeWrapper,
2024-07-18 15:11:13 +02:00
makeDesktopItem,
2024-07-17 19:14:44 +02:00
temurin-bin-17,
zip,
libglvnd,
alsa-lib,
libpulseaudio
}:
let
manifest = ''
Manifest-Version: 1.0
Main-Class: com.azefsw.audioconnect.desktop.app.MainKt
Specification-Title: Java Platform API Specification
Specification-Version: 17
Specification-Vendor: Oracle Corporation
Implementation-Title: Java Runtime Environment
Implementation-Version: 17.0.6
Implementation-Vendor: Eclipse Adoptium
Created-By: 17.0.5 (Eclipse Adoptium)
'';
runtimeLibs = [
libglvnd
alsa-lib
libpulseaudio
stdenv.cc.cc.lib
];
2024-07-18 15:11:13 +02:00
desktopItem = makeDesktopItem {
name = "audiorelay";
desktopName = "AudioRelay";
comment = "Stream audio between your devices";
categories = [ "AudioVideo" "Audio" "Network" ];
icon = "audiorelay";
exec = "audiorelay";
startupNotify = true;
startupWMClass = "com-azefsw-audioconnect-desktop-app-MainKt";
};
2024-07-17 19:14:44 +02:00
in
stdenv.mkDerivation {
pname = "audiorelay";
version = "0.27.5";
src = fetchzip {
url = "https://dl.audiorelay.net/setups/linux/audiorelay-0.27.5.tar.gz";
hash = "sha256-KfhAimDIkwYYUbEcgrhvN5DGHg8DpAHfGkibN1Ny4II=";
stripRoot = false;
};
nativeBuildInputs = [
makeWrapper
zip
];
# Patch the jar with manifest with main class to use it unwrapped
patchPhase = ''
mkdir META-INF
echo '${manifest}' > META-INF/MANIFEST.MF
zip -r lib/app/audiorelay.jar META-INF/MANIFEST.MF
'';
installPhase = ''
runHook preInstall
install -Dm644 ${desktopItem}/share/applications/audiorelay.desktop $out/share/applications/audiorelay.desktop
2024-07-18 15:21:14 +02:00
install -Dm644 lib/AudioRelay.png $out/share/pixmaps/audiorelay.png
2024-07-18 15:11:13 +02:00
2024-07-18 15:21:14 +02:00
install -Dm644 lib/app/audiorelay.jar $out/lib/audiorelay.jar
2024-07-17 19:14:44 +02:00
# Can't use from pkgs since these ones are older and newer fails to load some symbols
2024-07-18 15:21:14 +02:00
install -D lib/runtime/lib/libnative-rtaudio.so $out/lib/libnative-rtaudio.so
install -D lib/runtime/lib/libnative-opus.so $out/lib/libnative-opus.so
2024-07-17 19:14:44 +02:00
makeWrapper ${temurin-bin-17}/bin/java $out/bin/audiorelay \
--add-flags "-jar $out/lib/audiorelay.jar" \
--prefix LD_LIBRARY_PATH : $out/lib/ \
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath runtimeLibs}
runHook postInstall
'';
meta = {
description = "Application to stream every sound from your PC to one or multiple Android devices";
homepage = "https://audiorelay.net";
downloadPage = "https://audiorelay.net/downloads";
license = lib.licenses.unfree;
};
2024-07-17 19:14:44 +02:00
}