fluidsynth: add sound service option
Fluidsynth's systemd unit currently has a hard dependency on the pulseaudio systemd service. Since fluidsynth can use other sound services (e.g., pipewire-pulse), this should be configurable. This commit adds the relevant option. PR #2238
This commit is contained in:
parent
d11afee973
commit
72394f6d6b
|
@ -21,6 +21,15 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
soundService = mkOption {
|
||||
type = types.enum [ "jack" "pipewire-pulse" "pulseaudio" ];
|
||||
default = "pulseaudio";
|
||||
example = "pipewire-pulse";
|
||||
description = ''
|
||||
The systemd sound service to depend on.
|
||||
'';
|
||||
};
|
||||
|
||||
extraOptions = mkOption {
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
|
@ -46,8 +55,8 @@ in {
|
|||
Unit = {
|
||||
Description = "FluidSynth Daemon";
|
||||
Documentation = "man:fluidsynth(1)";
|
||||
BindsTo = [ "pulseaudio.service" ];
|
||||
After = [ "pulseaudio.service" ];
|
||||
BindsTo = [ (cfg.soundService + ".service") ];
|
||||
After = [ (cfg.soundService + ".service") ];
|
||||
};
|
||||
|
||||
Install = { WantedBy = [ "default.target" ]; };
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{ config, pkgs, ... }: {
|
||||
config = {
|
||||
services.fluidsynth.enable = true;
|
||||
services.fluidsynth.soundService = "pipewire-pulse";
|
||||
services.fluidsynth.soundFont = "/path/to/soundFont";
|
||||
services.fluidsynth.extraOptions = [ "--sample-rate 96000" ];
|
||||
|
||||
|
@ -19,6 +20,12 @@
|
|||
|
||||
assertFileContains $serviceFile \
|
||||
'ExecStart=@fluidsynth@/bin/fluidsynth -a pulseaudio -si --sample-rate 96000 /path/to/soundFont'
|
||||
|
||||
assertFileContains $serviceFile \
|
||||
'After=pipewire-pulse.service'
|
||||
|
||||
assertFileContains $serviceFile \
|
||||
'BindsTo=pipewire-pulse.service'
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue