From e541818517e6f9e3932108ce1bcf21995bf3b7c3 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 2 Jan 2017 20:08:18 +0100 Subject: l 2 baseX: remove pulse.nix and use pulseaudio --- lass/2configs/baseX.nix | 7 +++- lass/2configs/pulse.nix | 96 ------------------------------------------------- 2 files changed, 6 insertions(+), 97 deletions(-) delete mode 100644 lass/2configs/pulse.nix diff --git a/lass/2configs/baseX.nix b/lass/2configs/baseX.nix index e98f382e3..1e796015a 100644 --- a/lass/2configs/baseX.nix +++ b/lass/2configs/baseX.nix @@ -7,7 +7,12 @@ in { ./xserver ./mpv.nix ./power-action.nix - ./pulse.nix + { + hardware.pulseaudio = { + enable = true; + systemWide = true; + }; + } ]; users.extraUsers.mainUser.extraGroups = [ "audio" "video" ]; diff --git a/lass/2configs/pulse.nix b/lass/2configs/pulse.nix deleted file mode 100644 index 55efaea13..000000000 --- a/lass/2configs/pulse.nix +++ /dev/null @@ -1,96 +0,0 @@ -{ config, lib, pkgs, ... }: - -with import ; -let - pkg = pkgs.pulseaudioLight; - runDir = "/run/pulse"; - - alsaConf = pkgs.writeText "asound.conf" '' - ctl_type.pulse { - libs.native = ${pkgs.alsaPlugins}/lib/alsa-lib/libasound_module_ctl_pulse.so; - } - pcm_type.pulse { - libs.native = ${pkgs.alsaPlugins}/lib/alsa-lib/libasound_module_pcm_pulse.so; - } - ctl.!default { - type pulse - } - pcm.!default { - type pulse - } - ''; - - clientConf = pkgs.writeText "client.conf" '' - autospawn=no - default-server = unix:${runDir}/socket - ''; - - daemonConf = pkgs.writeText "daemon.conf" '' - exit-idle-time=-1 - flat-volumes = no - default-fragments = 4 - default-fragment-size-msec = 25 - ''; - - configFile = pkgs.writeText "default.pa" '' - .include ${pkg}/etc/pulse/default.pa - load-module ${toString [ - "module-native-protocol-unix" - "auth-anonymous=1" - "socket=${runDir}/socket" - ]} - ''; -in - -{ - environment = { - etc = { - "asound.conf".source = alsaConf; - # XXX mkForce is not strong enough (and neither is mkOverride) to create - # /etc/pulse/client.conf, see pulseaudio-hack below for a solution. - #"pulse/client.conf" = mkForce { source = clientConf; }; - #"pulse/client.conf".source = mkForce clientConf; - "pulse/default.pa".source = configFile; - "pulse/daemon.pa".source = daemonConf; - }; - systemPackages = [ - pkg - ] ++ optionals config.services.xserver.enable [ - pkgs.pavucontrol - ]; - }; - - # Allow PulseAudio to get realtime priority using rtkit. - security.rtkit.enable = true; - - system.activationScripts.pulseaudio-hack = '' - ln -fns ${clientConf} /etc/pulse/client.conf - ''; - - systemd.services.pulse = { - wantedBy = [ "sound.target" ]; - before = [ "sound.target" ]; - environment = { - PULSE_RUNTIME_PATH = "${runDir}/home"; - }; - serviceConfig = { - ExecStart = "${pkg}/bin/pulseaudio"; - ExecStartPre = pkgs.writeDash "pulse-start" '' - install -o pulse -g audio -m 0750 -d ${runDir} - install -o pulse -g audio -m 0700 -d ${runDir}/home - ''; - PermissionsStartOnly = "true"; - User = "pulse"; - }; - }; - - users = { - groups.pulse.gid = config.users.users.pulse.uid; - users.pulse = { - uid = genid "pulse"; - group = "pulse"; - extraGroups = [ "audio" ]; - home = "${runDir}/home"; - }; - }; -} -- cgit v1.2.3