mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-11 08:13:04 +00:00
f11d1d91cb
Noticed on fheroes2 package: before the change fheroes2 was not able to play MIDI samples and complained as: PlayMusic: music parameter was NULL It happens because default search paths for 'timidity.cfg' did not include any of nixos's paths in 'timidity/options.h': getenv("TIMIDITY_CFG") "." #define DEFAULT_PATH "/etc/timidity" #define DEFAULT_PATH1 "/usr/share/timidity" #define DEFAULT_PATH2 "/usr/local/share/timidity" #define DEFAULT_PATH3 "/usr/local/lib/timidity" As a result even with globally installed timidity MIDI can't be played. abuse package also has the same problem and works it around by changing directory to local copy of 'timidity.cfg': # The timidity bundled into SDL_mixer looks in . and in several global places # like /etc for its configuration file. cd @out@/etc exec @out@/bin/.abuse-bin "$@" The change fixes SDL2_mixer by changing "/usr/share/timidity" path to nix's timidity store path. Tested on fheroes2 with MIDI files.
76 lines
1.5 KiB
Nix
76 lines
1.5 KiB
Nix
{ lib, stdenv
|
|
, fetchurl
|
|
, pkg-config
|
|
, AudioToolbox
|
|
, AudioUnit
|
|
, CoreServices
|
|
, SDL2
|
|
, flac
|
|
, fluidsynth
|
|
, libmodplug
|
|
, libogg
|
|
, libvorbis
|
|
, mpg123
|
|
, opusfile
|
|
, smpeg2
|
|
, timidity
|
|
}:
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "SDL2_mixer";
|
|
version = "2.0.4";
|
|
|
|
src = fetchurl {
|
|
url = "https://www.libsdl.org/projects/SDL_mixer/release/${pname}-${version}.tar.gz";
|
|
sha256 = "0694vsz5bjkcdgfdra6x9fq8vpzrl8m6q96gh58df7065hw5mkxl";
|
|
};
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [
|
|
AudioToolbox
|
|
AudioUnit
|
|
CoreServices
|
|
];
|
|
|
|
propagatedBuildInputs = [
|
|
SDL2
|
|
flac
|
|
fluidsynth
|
|
libmodplug
|
|
libogg
|
|
libvorbis
|
|
mpg123
|
|
opusfile
|
|
smpeg2
|
|
# MIDI patterns
|
|
timidity
|
|
];
|
|
|
|
# fix default path to timidity.cfg so MIDI files could be played
|
|
postPatch = ''
|
|
substituteInPlace timidity/options.h \
|
|
--replace "/usr/share/timidity" "${timidity}/share/timidity"
|
|
'';
|
|
|
|
configureFlags = [
|
|
"--disable-music-ogg-shared"
|
|
"--disable-music-flac-shared"
|
|
"--disable-music-mod-modplug-shared"
|
|
"--disable-music-mp3-mpg123-shared"
|
|
"--disable-music-opus-shared"
|
|
"--disable-music-midi-fluidsynth-shared"
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
"--disable-sdltest"
|
|
"--disable-smpegtest"
|
|
];
|
|
|
|
meta = with lib; {
|
|
description = "SDL multi-channel audio mixer library";
|
|
platforms = platforms.unix;
|
|
homepage = "https://www.libsdl.org/projects/SDL_mixer/";
|
|
maintainers = with maintainers; [ MP2E ];
|
|
license = licenses.zlib;
|
|
};
|
|
}
|