1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-22 18:29:39 +01:00

pasystray: add extraOptions

Allows a user to, for example, add the `-g` option.

Also add a basic test case.
This commit is contained in:
Motiejus Jakštys 2023-09-18 15:20:32 +03:00 committed by Robert Helgesson
parent feb7006159
commit 8045eb45a7
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
5 changed files with 51 additions and 4 deletions

View file

@ -2,14 +2,26 @@
with lib;
{
let cfg = config.services.pasystray;
in {
meta.maintainers = [ hm.maintainers.pltanton ];
options = {
services.pasystray = { enable = mkEnableOption "PulseAudio system tray"; };
services.pasystray = {
enable = mkEnableOption "PulseAudio system tray";
extraOptions = mkOption {
type = types.listOf types.str;
default = [ ];
description = ''
Extra command-line arguments to pass to {command}`pasystray`.
'';
};
};
};
config = mkIf config.services.pasystray.enable {
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "services.pasystray" pkgs platforms.linux)
];
@ -28,7 +40,8 @@ with lib;
Environment =
let toolPaths = makeBinPath [ pkgs.paprefs pkgs.pavucontrol ];
in [ "PATH=${toolPaths}" ];
ExecStart = "${pkgs.pasystray}/bin/pasystray";
ExecStart = escapeShellArgs
([ "${pkgs.pasystray}/bin/pasystray" ] ++ cfg.extraOptions);
};
};
};