fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Motiejus Jakštyspasystray: add `extraOptions`8045eb45

master
1.2 KiB48 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let cfg = config.services.pasystray;
6
7in {
8  meta.maintainers = [ hm.maintainers.pltanton ];
9
10  options = {
11    services.pasystray = {
12      enable = mkEnableOption "PulseAudio system tray";
13
14      extraOptions = mkOption {
15        type = types.listOf types.str;
16        default = [ ];
17        description = ''
18          Extra command-line arguments to pass to {command}`pasystray`.
19        '';
20      };
21    };
22  };
23
24  config = mkIf cfg.enable {
25    assertions = [
26      (hm.assertions.assertPlatform "services.pasystray" pkgs platforms.linux)
27    ];
28
29    systemd.user.services.pasystray = {
30      Unit = {
31        Description = "PulseAudio system tray";
32        Requires = [ "tray.target" ];
33        After = [ "graphical-session-pre.target" "tray.target" ];
34        PartOf = [ "graphical-session.target" ];
35      };
36
37      Install = { WantedBy = [ "graphical-session.target" ]; };
38
39      Service = {
40        Environment =
41          let toolPaths = makeBinPath [ pkgs.paprefs pkgs.pavucontrol ];
42          in [ "PATH=${toolPaths}" ];
43        ExecStart = escapeShellArgs
44          ([ "${pkgs.pasystray}/bin/pasystray" ] ++ cfg.extraOptions);
45      };
46    };
47  };
48}