summary refs log tree commit diff
path: root/nixos/modules/config/pulseaudio.nix
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2016-04-10 11:17:52 +0200
committerVladimír Čunát <vcunat@gmail.com>2016-04-10 11:17:52 +0200
commit30f14243c33f1b386273d08a4776aa679c42143d (patch)
treebd123d5c2ab4fef012ae7de6a225c092f8d611b8 /nixos/modules/config/pulseaudio.nix
parent50fccad5828fb459760fd7578951bb961a18c0fc (diff)
parent2463e0917318581da94e7ba92703b63128c40424 (diff)
downloadnixpkgs-30f14243c33f1b386273d08a4776aa679c42143d.tar
nixpkgs-30f14243c33f1b386273d08a4776aa679c42143d.tar.gz
nixpkgs-30f14243c33f1b386273d08a4776aa679c42143d.tar.bz2
nixpkgs-30f14243c33f1b386273d08a4776aa679c42143d.tar.lz
nixpkgs-30f14243c33f1b386273d08a4776aa679c42143d.tar.xz
nixpkgs-30f14243c33f1b386273d08a4776aa679c42143d.tar.zst
nixpkgs-30f14243c33f1b386273d08a4776aa679c42143d.zip
Merge branch 'master' into closure-size
Comparison to master evaluations on Hydra:
  - 1255515 for nixos
  - 1255502 for nixpkgs
Diffstat (limited to 'nixos/modules/config/pulseaudio.nix')
-rw-r--r--nixos/modules/config/pulseaudio.nix28
1 files changed, 26 insertions, 2 deletions
diff --git a/nixos/modules/config/pulseaudio.nix b/nixos/modules/config/pulseaudio.nix
index 334fa1f772c..642aedc3f24 100644
--- a/nixos/modules/config/pulseaudio.nix
+++ b/nixos/modules/config/pulseaudio.nix
@@ -150,6 +150,29 @@ in {
         target = "pulse/default.pa";
         source = cfg.configFile;
       };
+
+      systemd.user = {
+        services.pulseaudio = {
+          description = "PulseAudio Server";
+          # NixOS doesn't support "Also" so we bring it in manually
+          wantedBy = [ "default.target" ];
+          serviceConfig = {
+            Type = "notify";
+            ExecStart = "${cfg.package}/bin/pulseaudio --daemonize=no";
+            Restart = "on-failure";
+          };
+        };
+
+        sockets.pulseaudio = {
+          description = "PulseAudio Socket";
+          wantedBy = [ "sockets.target" ];
+          socketConfig = {
+            Priority = 6;
+            Backlog = 5;
+            ListenStream = "%t/pulse/native";
+          };
+        };
+      };
     })
 
     (mkIf systemWide {
@@ -171,8 +194,9 @@ in {
         before = [ "sound.target" ];
         environment.PULSE_RUNTIME_PATH = stateDir;
         serviceConfig = {
-          ExecStart = "${cfg.package.out}/bin/pulseaudio -D --log-level=${cfg.daemon.logLevel} --system --use-pid-file -n --file=${cfg.configFile}";
-          PIDFile = "${stateDir}/pid";
+          Type = "notify";
+          ExecStart = "${cfg.package.out}/bin/pulseaudio --daemonize=no --log-level=${cfg.daemon.logLevel} --system -n --file=${cfg.configFile}";
+          Restart = "on-failure";
         };
       };
     })