1{ config
2, pkgs
3, lib
4, ...
5}:
6
7let
8 cfg = config.services.ayatana-indicators;
9in
10{
11 options.services.ayatana-indicators = {
12 enable = lib.mkEnableOption ''
13 Ayatana Indicators, a continuation of Canonical's Application Indicators
14 '';
15
16 packages = lib.mkOption {
17 type = lib.types.listOf lib.types.package;
18 default = [ ];
19 example = lib.literalExpression "with pkgs; [ ayatana-indicator-messages ]";
20 description = ''
21 List of packages containing Ayatana Indicator services
22 that should be brought up by the SystemD "ayatana-indicators" user target.
23
24 Packages specified here must have passthru.ayatana-indicators set correctly.
25
26 If, how, and where these indicators are displayed will depend on your DE.
27 '';
28 };
29 };
30
31 config = lib.mkIf cfg.enable {
32 environment = {
33 systemPackages = cfg.packages;
34
35 pathsToLink = [
36 "/share/ayatana"
37 ];
38 };
39
40 # libayatana-common's ayatana-indicators.target with explicit Wants & Before to bring up requested indicator services
41 systemd.user.targets."ayatana-indicators" =
42 let
43 indicatorServices = lib.lists.flatten
44 (map
45 (pkg:
46 (map (ind: "${ind}.service") pkg.passthru.ayatana-indicators))
47 cfg.packages);
48 in
49 {
50 description = "Target representing the lifecycle of the Ayatana Indicators. Each indicator should be bound to it in its individual service file";
51 partOf = [ "graphical-session.target" ];
52 wants = indicatorServices;
53 before = indicatorServices;
54 };
55 };
56
57 meta.maintainers = with lib.maintainers; [ OPNA2608 ];
58}