diff options
author | Franck Cuny <franck@fcuny.net> | 2022-02-08 19:58:38 -0800 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2022-02-08 19:59:17 -0800 |
commit | 3b1ac4f78d21802073c82df39ca7080ae70a67a9 (patch) | |
tree | 7895ede6ae0c31c7b1a77230619e8560404f6f2a /modules/desktop/sound.nix | |
parent | desktop: new option to control desktop setup (diff) | |
download | world-3b1ac4f78d21802073c82df39ca7080ae70a67a9.tar.gz |
desktop: install sound and xserver only when asked
Diffstat (limited to '')
-rw-r--r-- | modules/desktop/sound.nix | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/modules/desktop/sound.nix b/modules/desktop/sound.nix index 95c7c75..11c3fc2 100644 --- a/modules/desktop/sound.nix +++ b/modules/desktop/sound.nix @@ -1,20 +1,27 @@ {pkgs, config, lib, ...}: +with lib; -{ - sound.enable = true; +let + xorg = (elem "xorg" config.sys.graphics.desktopProtocols); + wayland = (elem "wayland" config.sys.graphics.desktopProtocols); + desktopMode = xorg || wayland; +in { + config= mkIf desktopMode { + sound.enable = true; - environment.systemPackages = with pkgs; [ - # We install it to get access to pactl. It isn't enabled or run as a service. - pulseaudio - ]; + environment.systemPackages = with pkgs; [ + # We install it to get access to pactl. It isn't enabled or run as a service. + pulseaudio + ]; - services.pipewire = { - enable = true; - # Compatibility shims, adjust according to your needs - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; + services.pipewire = { + enable = true; + # Compatibility shims, adjust according to your needs + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; + hardware.pulseaudio.enable = false; }; - hardware.pulseaudio.enable = false; } |