summaryrefslogtreecommitdiffstats
path: root/pkgs/development/libraries/SDL2_mixer/default.nix
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2021-09-05 14:50:20 +0100
committerSergei Trofimovich <slyich@gmail.com>2021-09-05 14:58:41 +0100
commitf11d1d91cb734a51e1138c6a8f71a0158dd1fa59 (patch)
tree05866b9be2e0850dd023f32131a24fd1ce9db09a /pkgs/development/libraries/SDL2_mixer/default.nix
parent31211d81dfbd4a6421f5deb600ad3c24eed03c60 (diff)
SDl2_mixer: fix MIDI playback by adding timidity paths
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.
Diffstat (limited to 'pkgs/development/libraries/SDL2_mixer/default.nix')
-rw-r--r--pkgs/development/libraries/SDL2_mixer/default.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkgs/development/libraries/SDL2_mixer/default.nix b/pkgs/development/libraries/SDL2_mixer/default.nix
index 7e1d097ba5cb..2d1ef9853819 100644
--- a/pkgs/development/libraries/SDL2_mixer/default.nix
+++ b/pkgs/development/libraries/SDL2_mixer/default.nix
@@ -13,6 +13,7 @@
, mpg123
, opusfile
, smpeg2
+, timidity
}:
stdenv.mkDerivation rec {
@@ -42,8 +43,16 @@ stdenv.mkDerivation rec {
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"