2021-05-27 23:01:52 +02:00
|
|
|
{ config, lib, pkgs, options, ... }:
|
2021-05-26 00:33:15 +02:00
|
|
|
|
|
|
|
let
|
2022-01-11 16:08:21 +01:00
|
|
|
inherit (lib)
|
|
|
|
mkEnableOption
|
|
|
|
mkIf
|
|
|
|
optionalAttrs
|
|
|
|
;
|
|
|
|
|
2021-05-26 00:33:15 +02:00
|
|
|
cfg = config.my.services.pipewire;
|
|
|
|
my = config.my;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.my.services.pipewire = {
|
2022-01-11 16:08:21 +01:00
|
|
|
enable = mkEnableOption "Pipewire sound backend";
|
2021-05-26 00:33:15 +02:00
|
|
|
};
|
|
|
|
|
2021-05-27 23:01:52 +02:00
|
|
|
# HACK: services.pipewire.alsa doesn't exist on 20.09, avoid evaluating this
|
|
|
|
# config (my 20.09 machine is a server anyway)
|
|
|
|
config = optionalAttrs (options ? services.pipewire.alsa) (mkIf cfg.enable {
|
2021-05-26 00:33:15 +02:00
|
|
|
# from NixOS wiki, causes conflicts with pipewire
|
|
|
|
sound.enable = false;
|
|
|
|
# recommended for pipewire as well
|
|
|
|
security.rtkit.enable = true;
|
|
|
|
services.pipewire = {
|
|
|
|
enable = true;
|
|
|
|
|
|
|
|
alsa = {
|
|
|
|
enable = true;
|
|
|
|
support32Bit = true;
|
|
|
|
};
|
|
|
|
pulse.enable = true;
|
|
|
|
jack.enable = true;
|
|
|
|
|
2022-03-11 15:49:12 +01:00
|
|
|
wireplumber.enable = true;
|
2021-05-26 00:33:15 +02:00
|
|
|
};
|
2021-05-26 01:13:10 +02:00
|
|
|
|
|
|
|
# FIXME: a shame pactl isn't available by itself, eventually this should be
|
|
|
|
# replaced by pw-cli or a wrapper, I guess?
|
2022-01-11 16:08:21 +01:00
|
|
|
environment.systemPackages = [ pkgs.pulseaudio ];
|
2021-05-27 23:01:52 +02:00
|
|
|
});
|
2021-05-26 00:33:15 +02:00
|
|
|
}
|