How to configure fluidsynth to use soundfont-fluid

After installing both fluidsynth and soundfont-fluid by specifying them in configuration.nix, fluidsynth tries to look for a default.sf2 in a directory that isn’t there, and sadly, there isn’t a configuration.nix file option to modify fluidsynth’s configuration.

Since in NixOS, you can’t simply edit the fluidsynth configuration in /etc/conf.d to point it to the right directory and file of the soundfont like in Arch, how can you make fluidsynth work?

I have no computer to test, but a few remarks:

  • nothing prevents you from indirectly adding things in /etc by using environment.etc as explained in the documentation of the option in NixOS Search
  • apparently you can also set the SDL_SOUNDFONTS environment variable (but it might only apply to applications running sdl_mixer, so not sure if it’s your case) via environment.variables (check doc and example in as before)
  • a third solution might be to create a package where $out/share/soundfonts/default.sf2 points to the soundfount you want, runCommand is an easy solution for this.

In all the above solutions, you may want to get the path to the soundfount using something like "${soundfont-fluid}/share/path/toyourfond.sf2", you may want to browse this directory first to check the exact path.

Sorry I don’t have much more time to give more examples, let me know if it works for you.

Specifying SDL_SOUNDFONTS worked, and what I wanted fluidsynth for (to have music in the Linux port of Rise of the Triad) initially worked, but then after the first APOGEE screen, the game crashed with this error dump:

/nix/store/1zy01hjzwvvia6h9dq5xar88v77fgh9x-glibc-2.38-44/lib/ [0x7f837cba9a70]
        /nix/store/psgmgni4zjm1fvkb8v7z9535vvij7y9n-fluidsynth-2.3.4/lib/ [0x7f837ca02c47]
        /nix/store/psgmgni4zjm1fvkb8v7z9535vvij7y9n-fluidsynth-2.3.4/lib/ [0x7f837ca04334]
        /nix/store/psgmgni4zjm1fvkb8v7z9535vvij7y9n-fluidsynth-2.3.4/lib/ [0x7f837ca04aa1]
        /nix/store/psgmgni4zjm1fvkb8v7z9535vvij7y9n-fluidsynth-2.3.4/lib/ [0x7f837ca1b954]
        /nix/store/hx8z4hfybjzqd6am90nyp1lbg9kwcm03-SDL_mixer-1.2.12/lib/ [0x7f837cd6f68b]
        /nix/store/hx8z4hfybjzqd6am90nyp1lbg9kwcm03-SDL_mixer-1.2.12/lib/ [0x7f837cd62a89]
        /nix/store/8nxqdk4b08xz9bfkzwqqr25n3bvkhw5n-rott-1.1.2/libexec/rott() [0x477f72]
        /nix/store/8nxqdk4b08xz9bfkzwqqr25n3bvkhw5n-rott-1.1.2/libexec/rott() [0x45fef9]
        /nix/store/8nxqdk4b08xz9bfkzwqqr25n3bvkhw5n-rott-1.1.2/libexec/rott() [0x46025d]
        /nix/store/8nxqdk4b08xz9bfkzwqqr25n3bvkhw5n-rott-1.1.2/libexec/rott() [0x4429e4]
        /nix/store/8nxqdk4b08xz9bfkzwqqr25n3bvkhw5n-rott-1.1.2/libexec/rott(main+0x186) [0x403916]
        /nix/store/1zy01hjzwvvia6h9dq5xar88v77fgh9x-glibc-2.38-44/lib/ [0x7f837cb93fce]
        /nix/store/1zy01hjzwvvia6h9dq5xar88v77fgh9x-glibc-2.38-44/lib/ [0x7f837cb94089]
        /nix/store/8nxqdk4b08xz9bfkzwqqr25n3bvkhw5n-rott-1.1.2/libexec/rott() [0x403bb5]

Can you maybe share your config so that we can try to reproduce it locally? Have you tried to run strace to check if it crashed while accessing a file for instance?

I’n confused, I see no reference to the SDL_SOUNDFONTS variable, how do you configure it? Also how do you install and run the game you mention? just realized it is rott