helm/modules/hardware/audio.nix
Henrik Lissner d317303dac Bump
agenix: e543aa7 -> fb00f17
emacs-overlay: 9fbb5e4 -> 9da066d
home-manager: ac319fd -> f6f6990
nixos-hardware: 4177578 -> 03e7686
nixpkgs-unstable: f930ea2 -> ecaf3da

No need for ALSA fix anymore; fix is in nixos-unstable now.
2021-07-28 00:32:32 -04:00

32 lines
989 B
Nix

{ options, config, lib, pkgs, ... }:
with lib;
with lib.my;
let cfg = config.modules.hardware.audio;
in {
options.modules.hardware.audio = {
enable = mkBoolOpt false;
};
config = mkIf cfg.enable {
sound.enable = true;
hardware.pulseaudio.enable = true;
# HACK Prevents ~/.esd_auth files by disabling the esound protocol module
# for pulseaudio, which I likely don't need. Is there a better way?
hardware.pulseaudio.configFile =
let inherit (pkgs) runCommand pulseaudio;
paConfigFile =
runCommand "disablePulseaudioEsoundModule"
{ buildInputs = [ pulseaudio ]; } ''
mkdir "$out"
cp ${pulseaudio}/etc/pulse/default.pa "$out/default.pa"
sed -i -e 's|load-module module-esound-protocol-unix|# ...|' "$out/default.pa"
'';
in mkIf config.hardware.pulseaudio.enable
"${paConfigFile}/default.pa";
user.extraGroups = [ "audio" ];
};
}