1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00
home-manager/modules/services/pasystray.nix
Austin Horstman 03fdb31290
treewide: add missing package options (#7575)
Add options to support more flexible module configurations.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-07-29 12:20:22 -05:00

63 lines
1.3 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.pasystray;
in
{
meta.maintainers = [ lib.hm.maintainers.pltanton ];
options = {
services.pasystray = {
enable = lib.mkEnableOption "PulseAudio system tray";
package = lib.mkPackageOption pkgs "pasystray" { };
extraOptions = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
description = ''
Extra command-line arguments to pass to {command}`pasystray`.
'';
};
};
};
config = lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.pasystray" pkgs lib.platforms.linux)
];
systemd.user.services.pasystray = {
Unit = {
Description = "PulseAudio system tray";
Requires = [ "tray.target" ];
After = [
"graphical-session.target"
"tray.target"
];
PartOf = [ "graphical-session.target" ];
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
Service = {
Environment =
let
toolPaths = lib.makeBinPath [
pkgs.paprefs
pkgs.pavucontrol
];
in
[ "PATH=${toolPaths}" ];
ExecStart = lib.escapeShellArgs ([ (lib.getExe cfg.package) ] ++ cfg.extraOptions);
};
};
};
}