From 90bcaaf582c46af65bcdc64de65ef6b0e571ac52 Mon Sep 17 00:00:00 2001
From: Anton Plotnikov <aplotnikov@openwaygroup.com>
Date: Tue, 21 Aug 2018 16:52:45 +0300
Subject: [PATCH] pasystray: add module

---
 modules/misc/news.nix          |  7 +++++++
 modules/modules.nix            |  1 +
 modules/services/pasystray.nix | 31 +++++++++++++++++++++++++++++++
 3 files changed, 39 insertions(+)
 create mode 100644 modules/services/pasystray.nix

diff --git a/modules/misc/news.nix b/modules/misc/news.nix
index bcf0c766b..8e8936587 100644
--- a/modules/misc/news.nix
+++ b/modules/misc/news.nix
@@ -765,6 +765,13 @@ in
           A new module is available: 'programs.msmtp'.
         '';
       }
+
+      {
+        time = "2018-08-21T20:13:50+00:00";
+        message = ''
+          A new module is available: 'services.pasystray'.
+        '';
+      }
     ];
   };
 }
diff --git a/modules/modules.nix b/modules/modules.nix
index d08a418e3..914d275c3 100644
--- a/modules/modules.nix
+++ b/modules/modules.nix
@@ -71,6 +71,7 @@ let
     ./services/network-manager-applet.nix
     ./services/owncloud-client.nix
     ./services/parcellite.nix
+    ./services/pasystray.nix
     ./services/polybar.nix
     ./services/random-background.nix
     ./services/redshift.nix
diff --git a/modules/services/pasystray.nix b/modules/services/pasystray.nix
new file mode 100644
index 000000000..da0436b66
--- /dev/null
+++ b/modules/services/pasystray.nix
@@ -0,0 +1,31 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+  meta.maintainers = [ maintainers.pltanton ];
+
+  options = {
+    services.pasystray = {
+      enable = mkEnableOption "PulseAudio system tray";
+    };
+  };
+
+  config = mkIf config.services.pasystray.enable {
+    systemd.user.services.pasystray = {
+        Unit = {
+          Description = "PulseAudio system tray";
+          After = [ "graphical-session-pre.target" ];
+          PartOf = [ "graphical-session.target" ];
+        };
+
+        Install = {
+          WantedBy = [ "graphical-session.target" ];
+        };
+
+        Service = {
+          ExecStart = "${pkgs.pasystray}/bin/pasystray";
+        };
+    };
+  };
+}