···20 example = lib.literalExpression "with pkgs; [ ayatana-indicator-messages ]";
21 description = ''
22 List of packages containing Ayatana Indicator services
23- that should be brought up by the SystemD "ayatana-indicators" user target.
2425 Packages specified here must have passthru.ayatana-indicators set correctly.
2627 If, how, and where these indicators are displayed will depend on your DE.
028 '';
29 };
30 };
···39 # libayatana-common's ayatana-indicators.target with explicit Wants & Before to bring up requested indicator services
40 systemd.user.targets =
41 let
42- indicatorServices = lib.lists.flatten (
43- map (pkg: (map (ind: "${ind}.service") pkg.passthru.ayatana-indicators)) cfg.packages
44- );
0000000000000000000045 in
46 lib.attrsets.mapAttrs
47- (_: desc: {
48 description = "Target representing the lifecycle of the ${desc}. Each indicator should be bound to it in its individual service file";
49 partOf = [ "graphical-session.target" ];
50- wants = indicatorServices;
51- before = indicatorServices;
52 })
53 {
54 ayatana-indicators = "Ayatana Indicators";
···20 example = lib.literalExpression "with pkgs; [ ayatana-indicator-messages ]";
21 description = ''
22 List of packages containing Ayatana Indicator services
23+ that should be brought up by a SystemD "ayatana-indicators" user target.
2425 Packages specified here must have passthru.ayatana-indicators set correctly.
2627 If, how, and where these indicators are displayed will depend on your DE.
28+ Which target they will be brought up by depends on the packages' passthru.ayatana-indicators.
29 '';
30 };
31 };
···40 # libayatana-common's ayatana-indicators.target with explicit Wants & Before to bring up requested indicator services
41 systemd.user.targets =
42 let
43+ namesToServices = map (indicator: "${indicator}.service");
44+ indicatorServices =
45+ target:
46+ lib.lists.flatten (
47+ map (
48+ pkg:
49+ if lib.isList pkg.passthru.ayatana-indicators then
50+ # Old format, add to every target
51+ (lib.warn "${pkg.name} is using the old passthru.ayatana-indicators format, please update it!" (
52+ namesToServices pkg.passthru.ayatana-indicators
53+ ))
54+ else
55+ # New format, filter by target being mentioned
56+ (namesToServices (
57+ builtins.filter (
58+ service:
59+ builtins.any (
60+ targetPrefix: "${targetPrefix}-indicators" == target
61+ ) pkg.passthru.ayatana-indicators.${service}
62+ ) (builtins.attrNames pkg.passthru.ayatana-indicators)
63+ ))
64+ ) cfg.packages
65+ );
66 in
67 lib.attrsets.mapAttrs
68+ (name: desc: {
69 description = "Target representing the lifecycle of the ${desc}. Each indicator should be bound to it in its individual service file";
70 partOf = [ "graphical-session.target" ];
71+ wants = indicatorServices name;
72+ before = indicatorServices name;
73 })
74 {
75 ayatana-indicators = "Ayatana Indicators";