aboutsummaryrefslogtreecommitdiff
path: root/modules/services/pasystray.nix
blob: 8f92f34c091d710f2e0a6e5601bb357ae5754718 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ 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 = {
          Environment =
            let
              toolPaths = makeBinPath [ pkgs.paprefs pkgs.pavucontrol ];
            in
              [ "PATH=${toolPaths}" ];
          ExecStart = "${pkgs.pasystray}/bin/pasystray";
        };
    };
  };
}