From 417cb0a8736780568f9fa67ff32b7d47040ba5e3 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 14 Jan 2016 15:45:41 +0100 Subject: tv pulse: lol tmpfiles No combination of systemd options could be identified to automatically restart systemd-tmpfiles-setup.service whenever pulse.service gets started, so deploying systemd.services.pulse to a running system will leave pulse.service in a failed state. --- tv/2configs/pulse.nix | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'tv/2configs/pulse.nix') diff --git a/tv/2configs/pulse.nix b/tv/2configs/pulse.nix index 3db3532d..c12c3c53 100644 --- a/tv/2configs/pulse.nix +++ b/tv/2configs/pulse.nix @@ -35,11 +35,6 @@ let in { - systemd.tmpfiles.rules = [ - "d ${runDir} 0750 pulse pulse - -" - "d ${runDir}/home 0700 pulse pulse - -" - ]; - system.activationScripts.pulseaudio-hack = '' ln -fns ${clientConf} /etc/pulse/client.conf ''; @@ -65,6 +60,12 @@ in }; serviceConfig = { ExecStart = "${pkg}/bin/pulseaudio"; + ExecStartPre = pkgs.writeScript "pulse-start" '' + #! /bin/sh + install -o pulse -g pulse -m 0750 -d ${runDir} + install -o pulse -g pulse -m 0700 -d ${runDir}/home + ''; + PermissionsStartOnly = "true"; User = "pulse"; }; }; -- cgit v1.2.3 From 7c97b64549913863498c4dca214cd9a890a0d00c Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 14 Jan 2016 15:48:16 +0100 Subject: tv pulse: explain pulseaudio-hack --- tv/2configs/pulse.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'tv/2configs/pulse.nix') diff --git a/tv/2configs/pulse.nix b/tv/2configs/pulse.nix index c12c3c53..55ee8d8e 100644 --- a/tv/2configs/pulse.nix +++ b/tv/2configs/pulse.nix @@ -1,5 +1,6 @@ { config, lib, pkgs, ... }: +with lib; let pkg = pkgs.pulseaudioLight; runDir = "/run/pulse"; @@ -35,14 +36,13 @@ let in { - system.activationScripts.pulseaudio-hack = '' - ln -fns ${clientConf} /etc/pulse/client.conf - ''; - environment = { etc = { "asound.conf".source = alsaConf; - #"pulse/client.conf" = lib.mkForce { source = clientConf; }; + # 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; }; systemPackages = [ pkg ]; @@ -51,12 +51,15 @@ in # 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"; - #DISPLAY = ":${toString config.services.xserver.display}"; }; serviceConfig = { ExecStart = "${pkg}/bin/pulseaudio"; -- cgit v1.2.3 From f648c930fe2da2760b86c4bcf35b9e05803b8534 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 14 Jan 2016 15:51:41 +0100 Subject: tv: install pavucontrol only when xserver is enabled --- tv/2configs/pulse.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tv/2configs/pulse.nix') diff --git a/tv/2configs/pulse.nix b/tv/2configs/pulse.nix index 55ee8d8e..e1894ca6 100644 --- a/tv/2configs/pulse.nix +++ b/tv/2configs/pulse.nix @@ -45,7 +45,11 @@ in #"pulse/client.conf".source = mkForce clientConf; "pulse/default.pa".source = configFile; }; - systemPackages = [ pkg ]; + systemPackages = [ + pkg + ] ++ optionals config.services.xserver.enable [ + pkgs.pavucontrol + ]; }; # Allow PulseAudio to get realtime priority using rtkit. -- cgit v1.2.3