1 { lib, stdenv, fetchFromGitHub, cmake, pkg-config, removeReferencesTo
2 , alsaSupport ? !stdenv.isDarwin, alsa-lib
3 , dbusSupport ? !stdenv.isDarwin, dbus
4 , pipewireSupport ? !stdenv.isDarwin, pipewire
5 , pulseSupport ? !stdenv.isDarwin, libpulseaudio
6 , CoreServices, AudioUnit, AudioToolbox
9 stdenv.mkDerivation rec {
10 pname = "openal-soft";
13 src = fetchFromGitHub {
17 sha256 = "sha256-jwY1NzNJdWIvVv7TvJyg4cIGFLWGZhL3BkMI1NbOEG0=";
21 # this will make it find its own data files (e.g. HRTF profiles)
22 # without any other configuration
26 substituteInPlace core/helpers.cpp \
27 --replace "@OUT@" $out
32 nativeBuildInputs = [ cmake pkg-config removeReferencesTo ];
34 buildInputs = lib.optional alsaSupport alsa-lib
35 ++ lib.optional dbusSupport dbus
36 ++ lib.optional pipewireSupport pipewire
37 ++ lib.optional pulseSupport libpulseaudio
38 ++ lib.optionals stdenv.isDarwin [ CoreServices AudioUnit AudioToolbox ];
41 # Automatically links dependencies without having to rely on dlopen, thus
42 # removes the need for NIX_LDFLAGS.
44 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
45 # https://github.com/NixOS/nixpkgs/issues/183774
46 "-DOSS_INCLUDE_DIR=${stdenv.cc.libc}/include"
49 postInstall = lib.optional pipewireSupport ''
50 remove-references-to -t ${pipewire.dev} $(readlink -f $out/lib/*.so)
54 description = "OpenAL alternative";
55 homepage = "https://openal-soft.org/";
56 license = licenses.lgpl2;
57 maintainers = with maintainers; [ftrvxmtrx];
58 platforms = platforms.unix;