nixpkgs/pkgs/servers/hqplayerd/default.nix
2022-07-09 03:02:23 -04:00

118 lines
2.4 KiB
Nix

{ stdenv, lib
, addOpenGLRunpath
, alsa-lib
, autoPatchelfHook
, cairo
, fetchurl
, flac
, gcc11
, gnome
, gssdp
, gupnp
, gupnp-av
, lame
, libgmpris
, libusb-compat-0_1
, llvmPackages_10
, meson
, mpg123
, ninja
, rpmextract
, wavpack
}:
stdenv.mkDerivation rec {
pname = "hqplayerd";
version = "4.32.2-92";
src = fetchurl {
url = "https://www.signalyst.eu/bins/${pname}/fc35/${pname}-${version}.fc35.x86_64.rpm";
hash = "sha256-chgzu5r35VTSc1xOVTPCWCRrjABOy+vs57SsKOSzvkM=";
};
unpackPhase = ''
${rpmextract}/bin/rpmextract $src
'';
nativeBuildInputs = [ addOpenGLRunpath autoPatchelfHook rpmextract ];
buildInputs = [
alsa-lib
cairo
flac
gcc11.cc.lib
gnome.rygel
gssdp
gupnp
gupnp-av
lame
libgmpris
libusb-compat-0_1
llvmPackages_10.openmp
mpg123
wavpack
];
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
# executables
mkdir -p $out
cp -rv ./usr/bin $out/bin
# libs
mkdir -p $out
cp -rv ./opt/hqplayerd/lib $out
# configuration
mkdir -p $out/etc
cp -rv ./etc/hqplayer $out/etc/
# udev rules
mkdir -p $out/etc/udev
cp -rv ./etc/udev/rules.d $out/etc/udev/
# kernel module cfgs
mkdir -p $out/etc
cp -rv ./etc/modules-load.d $out/etc/
# systemd service file
mkdir -p $out/lib/systemd
cp -rv ./usr/lib/systemd/system $out/lib/systemd/
# documentation
mkdir -p $out/share/doc
cp -rv ./usr/share/doc/hqplayerd $out/share/doc/
# misc service support files
mkdir -p $out/var/lib
cp -rv ./var/lib/hqplayer $out/var/lib/
runHook postInstall
'';
postInstall = ''
substituteInPlace $out/lib/systemd/system/hqplayerd.service \
--replace /usr/bin/hqplayerd $out/bin/hqplayerd \
--replace "NetworkManager-wait-online.service" ""
'';
# NB: addOpenGLRunpath needs to run _after_ autoPatchelfHook, which runs in
# postFixup, so we tack it on here.
doInstallCheck = true;
installCheckPhase = ''
addOpenGLRunpath $out/bin/hqplayerd
$out/bin/hqplayerd --version
'';
meta = with lib; {
homepage = "https://www.signalyst.com/custom.html";
description = "High-end upsampling multichannel software embedded HD-audio player";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ lovesegfault ];
};
}