nixpkgs/pkgs/by-name/so/sonobus/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

87 lines
1.8 KiB
Nix

{ lib
, pkg-config
, stdenv
, fetchFromGitHub
, autoPatchelfHook
, alsa-lib
, cmake
, freetype
, libGL
, libX11
, libXcursor
, libXext
, libXinerama
, libXrandr
, libjack2
, libopus
, curl
, gtk3
, webkitgtk_4_0
}:
stdenv.mkDerivation (finalAttrs: {
pname = "sonobus";
version = "1.7.2";
src = fetchFromGitHub {
owner = "sonosaurus";
repo = "sonobus";
rev = finalAttrs.version;
hash = "sha256-NOdmHFKrV7lb8XbeG5GdLKYZ0c/vcz3fcqYj9JvE+/Q=";
fetchSubmodules = true;
};
nativeBuildInputs = [
autoPatchelfHook
cmake
pkg-config
];
buildInputs = [
alsa-lib
freetype
libjack2
libopus
curl
gtk3
webkitgtk_4_0
];
runtimeDependencies = [
libGL
libX11
libXcursor
libXext
libXinerama
libXrandr
];
env.NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isLinux "-rpath ${lib.makeLibraryPath (finalAttrs.runtimeDependencies)}";
dontPatchELF = true; # needed or nix will try to optimize the binary by removing "useless" rpath
postPatch = lib.optionalString (stdenv.hostPlatform.isLinux) ''
# needs special setup on Linux, dunno if it can work on Darwin
# Also, I get issues with linking without that, not sure why
sed -i -e '/juce::juce_recommended_lto_flags/d' CMakeLists.txt
patchShebangs linux/install.sh
'';
# The program does not provide any CMake install instructions
installPhase = lib.optionalString (stdenv.hostPlatform.isLinux) ''
runHook preInstall
cd ../linux
./install.sh "$out"
runHook postInstall
'';
meta = with lib; {
description = "High-quality network audio streaming";
homepage = "https://sonobus.net/";
license = with licenses; [ gpl3Plus ];
maintainers = with maintainers; [ PowerUser64 ];
platforms = platforms.unix;
broken = stdenv.hostPlatform.isDarwin;
mainProgram = "sonobus";
};
})