summary refs log tree commit diff
path: root/nixos/modules/services/desktops
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2018-07-06 12:00:10 +0800
committerPeter Hoeg <peter@hoeg.com>2018-07-06 12:03:24 +0800
commit139a6b41067b743f7d3f516c2a82eec948a06ebd (patch)
tree4db86f4074de9b5655bae6f32da167ca67c04b49 /nixos/modules/services/desktops
parentbe1461fc0ab29c45c69e7b2c2097c887750e4fe0 (diff)
downloadnixlib-139a6b41067b743f7d3f516c2a82eec948a06ebd.tar
nixlib-139a6b41067b743f7d3f516c2a82eec948a06ebd.tar.gz
nixlib-139a6b41067b743f7d3f516c2a82eec948a06ebd.tar.bz2
nixlib-139a6b41067b743f7d3f516c2a82eec948a06ebd.tar.lz
nixlib-139a6b41067b743f7d3f516c2a82eec948a06ebd.tar.xz
nixlib-139a6b41067b743f7d3f516c2a82eec948a06ebd.tar.zst
nixlib-139a6b41067b743f7d3f516c2a82eec948a06ebd.zip
pipewire (nixos): add support for socket activation
Diffstat (limited to 'nixos/modules/services/desktops')
-rw-r--r--nixos/modules/services/desktops/pipewire.nix22
1 files changed, 18 insertions, 4 deletions
diff --git a/nixos/modules/services/desktops/pipewire.nix b/nixos/modules/services/desktops/pipewire.nix
index 263a06156f84..13f3d61e84ca 100644
--- a/nixos/modules/services/desktops/pipewire.nix
+++ b/nixos/modules/services/desktops/pipewire.nix
@@ -3,20 +3,34 @@
 
 with lib;
 
-{
+let
+  cfg = config.services.pipewire;
+  packages = with pkgs; [ pipewire ];
+
+in {
   ###### interface
   options = {
     services.pipewire = {
       enable = mkEnableOption "pipewire service";
+
+      socketActivation = mkOption {
+        default = true;
+        type = types.bool;
+        description = ''
+          Automatically run pipewire when connections are made to the pipewire socket.
+        '';
+      };
     };
   };
 
 
   ###### implementation
-  config = mkIf config.services.pipewire.enable {
-    environment.systemPackages = [ pkgs.pipewire ];
+  config = mkIf cfg.enable {
+    environment.systemPackages = packages;
+
+    systemd.packages = packages;
 
-    systemd.packages = [ pkgs.pipewire ];
+    systemd.user.sockets.pipewire.wantedBy = lib.mkIf cfg.socketActivation [ "sockets.target" ];
   };
 
   meta.maintainers = with lib.maintainers; [ jtojnar ];