From 6c7786074f8a3d925cd559bc6a51ba85e53bbd37 Mon Sep 17 00:00:00 2001 From: Aristid Breitkreuz Date: Sun, 5 Oct 2014 19:50:35 +0200 Subject: [PATCH] fix sound in minecraft for pulseaudio users --- pkgs/games/minecraft/default.nix | 5 +++-- pkgs/servers/pulseaudio/default.nix | 9 ++++++--- pkgs/top-level/all-packages.nix | 5 ++++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pkgs/games/minecraft/default.nix b/pkgs/games/minecraft/default.nix index 9f79dd70c6a0..70bda820e2ec 100644 --- a/pkgs/games/minecraft/default.nix +++ b/pkgs/games/minecraft/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, jre, libX11, libXext, libXcursor, libXrandr, libXxf86vm -, mesa, openal, alsaOss }: +, mesa, openal, alsaOss, pulseaudioSupport ? false, pulseaudio }: assert jre ? architecture; @@ -23,7 +23,8 @@ stdenv.mkDerivation { # wrapper for minecraft export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${jre}/lib/${jre.architecture}/:${libX11}/lib/:${libXext}/lib/:${libXcursor}/lib/:${libXrandr}/lib/:${libXxf86vm}/lib/:${mesa}/lib/:${openal}/lib/ - ${alsaOss}/bin/aoss ${jre}/bin/java -jar $out/minecraft.jar + ${if pulseaudioSupport then "${pulseaudio}/bin/padsp" else "${alsaOss}/bin/aoss" } \ + ${jre}/bin/java -jar $out/minecraft.jar EOF chmod +x $out/bin/minecraft diff --git a/pkgs/servers/pulseaudio/default.nix b/pkgs/servers/pulseaudio/default.nix index de262af095cb..5e0bc4f60f1b 100644 --- a/pkgs/servers/pulseaudio/default.nix +++ b/pkgs/servers/pulseaudio/default.nix @@ -3,7 +3,8 @@ , bluez, sbc, udev, libcap, json_c , jackaudioSupport ? false, jack2 ? null , x11Support ? false, xlibs -, useSystemd ? false, systemd ? null }: +, useSystemd ? false, systemd ? null +, ossWrapper ? false }: assert jackaudioSupport -> jack2 != null; @@ -49,11 +50,13 @@ stdenv.mkDerivation rec { "--disable-solaris" "--disable-jack" "--disable-oss-output" - "--disable-oss-wrapper" + ] ++ stdenv.lib.optional (!ossWrapper) "--disable-oss-wrapper" ++ + [ "--localstatedir=/var" "--sysconfdir=/etc" "--with-access-group=audio" - ] ++ stdenv.lib.optional jackaudioSupport "--enable-jack" + ] + ++ stdenv.lib.optional jackaudioSupport "--enable-jack" ++ stdenv.lib.optional stdenv.isDarwin "--with-mac-sysroot=/"; enableParallelBuilding = true; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index f4286623be8d..0ddec25f6e35 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1628,7 +1628,10 @@ let mfoc = callPackage ../tools/security/mfoc { }; - minecraft = callPackage ../games/minecraft { }; + minecraft = callPackage ../games/minecraft { + pulseaudioSupport = config.pulseaudio or true; + pulseaudio = pulseaudio.override { ossWrapper = true; }; + }; minecraft-server = callPackage ../games/minecraft-server { };