nixpkgs/pkgs/by-name/ro/roon-bridge/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

84 lines
2.3 KiB
Nix

{ alsa-lib
, alsa-utils
, autoPatchelfHook
, fetchurl
, ffmpeg
, lib
, makeWrapper
, openssl
, stdenv
, zlib
}:
let
version = "1.8-1125";
urlVersion = builtins.replaceStrings [ "." "-" ] [ "00" "0" ] version;
host = stdenv.hostPlatform.system;
system = if host == "x86_64-linux" then "linuxx64"
else if host == "aarch64-linux" then "linuxarmv8"
else throw "Unsupported platform ${host}";
src = fetchurl {
url = "https://download.roonlabs.com/updates/stable/RoonBridge_${system}_${urlVersion}.tar.bz2";
hash = if system == "linuxx64" then "sha256-DbtKPFEz2WIoKTxP+zoehzz+BjfsLZ2ZQk/FMh+zFBM="
else if system == "linuxarmv8" then "sha256-+przEj96R+f1z4ewETFarF4oY6tT2VW/ukSTgUBLiYk="
else throw "Unsupported platform ${host}";
};
in
stdenv.mkDerivation {
pname = "roon-bridge";
inherit src version;
dontConfigure = true;
dontBuild = true;
buildInputs = [
alsa-lib
zlib
(lib.getLib stdenv.cc.cc)
];
nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
installPhase =
let
fixBin = binPath: ''
(
sed -i '/ulimit/d' ${binPath}
sed -i 's@^SCRIPT=.*@SCRIPT="$(basename "${binPath}")"@' ${binPath}
wrapProgram ${binPath} \
--argv0 "$(basename ${binPath})" \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ alsa-lib ffmpeg openssl ]}" \
--prefix PATH : "${lib.makeBinPath [ alsa-utils ffmpeg ]}"
)
'';
in
''
runHook preInstall
mkdir -p $out
mv * $out
rm $out/check.sh
rm $out/start.sh
rm $out/VERSION
${fixBin "${placeholder "out"}/Bridge/RAATServer"}
${fixBin "${placeholder "out"}/Bridge/RoonBridge"}
${fixBin "${placeholder "out"}/Bridge/RoonBridgeHelper"}
mkdir -p $out/bin
makeWrapper "$out/Bridge/RoonBridge" "$out/bin/RoonBridge" --chdir "$out"
runHook postInstall
'';
meta = with lib; {
description = "Music player for music lovers";
changelog = "https://community.roonlabs.com/c/roon/software-release-notes/18";
homepage = "https://roonlabs.com";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
maintainers = with maintainers; [ lovesegfault ];
platforms = [ "aarch64-linux" "x86_64-linux" ];
mainProgram = "RoonBridge";
};
}