Skip to content

Instantly share code, notes, and snippets.

@lovesegfault
Created July 23, 2021 23:02
Show Gist options
  • Save lovesegfault/1ff44f68b6ea975bc8d7201e5eda978f to your computer and use it in GitHub Desktop.
Save lovesegfault/1ff44f68b6ea975bc8d7201e5eda978f to your computer and use it in GitHub Desktop.
{ stdenv
, buildFHSUserEnv
, fetchurl
, lib
, rpmextract
, writeShellScript
}:
let
pname = "hqplayerd";
pkg = stdenv.mkDerivation rec {
inherit pname;
version = "4.24.2-63";
src = fetchurl {
url = "https://www.signalyst.eu/bins/${pname}/fc34/${pname}-${version}.fc34.x86_64.rpm";
sha256 = "sha256-6JUgHDO+S73n/IVQhkmC0Nw4GQVzTLtiBbz/wZiflRg=";
};
unpackPhase = ''
${rpmextract}/bin/rpmextract $src
'';
nativeBuildInputs = [ rpmextract ];
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
# main executable
mkdir -p $out/bin
cp ./usr/bin/hqplayerd $out/bin
# udev rules
mkdir -p $out/etc/udev/rules.d
cp ./etc/udev/rules.d/50-taudio2.rules $out/etc/udev/rules.d
# kernel module cfgs
mkdir -p $out/etc/modules-load.d
cp ./etc/modules-load.d/taudio2.conf $out/etc/modules-load.d
# systemd service file
mkdir -p $out/lib/systemd/system
cp ./usr/lib/systemd/system/hqplayerd.service $out/lib/systemd/system
# documentation
mkdir -p $out/share/doc/hqplayerd
cp ./usr/share/doc/hqplayerd/* $out/share/doc/hqplayerd
# misc service support files
mkdir -p $out/var/lib/hqplayer
cp -r ./var/lib/hqplayer/web $out/var/lib/hqplayer/web
runHook postInstall
'';
postFixup = ''
patchelf --replace-needed libomp.so.5 libomp.so $out/bin/hqplayerd
'';
meta = with lib; {
homepage = "https://www.signalyst.com/custom.html";
description = "High-end upsampling multichannel software embedded HD-audio player";
license = licenses.unfree;
maintainers = with maintainers; [ lovesegfault ];
};
};
in
buildFHSUserEnv {
name = pname;
# extraBuildCommands = ''
# chmod +w $out/var/lib/hqplayer
# mkdir -p $out/var/lib/hqplayer
# touch $out/var/lib/hqplayer/keep
# '';
runScript = writeShellScript "hqplayerd-run-script" ''
set -eux
mkdir -p /var/lib/hqplayer
exec ${pkg}/bin/hqplayerd "''${@}"
'';
targetPkgs = pkgs: with pkgs; [
pkg
strace
alsa-lib
cairo
flac
glib
gnome.libgee
gnome.rygel
gssdp
gupnp
gupnp_av
libgmpris
libogg
libsoup
llvmPackages_10.openmp
wavpack
(lib.hiPrio gcc11.cc.lib)
];
passthru.unwrapped = pkg;
inherit (pkg) meta;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment