···2020 example = lib.literalExpression "with pkgs; [ ayatana-indicator-messages ]";
2121 description = ''
2222 List of packages containing Ayatana Indicator services
2323- that should be brought up by the SystemD "ayatana-indicators" user target.
2323+ that should be brought up by a SystemD "ayatana-indicators" user target.
24242525 Packages specified here must have passthru.ayatana-indicators set correctly.
26262727 If, how, and where these indicators are displayed will depend on your DE.
2828+ Which target they will be brought up by depends on the packages' passthru.ayatana-indicators.
2829 '';
2930 };
3031 };
···3940 # libayatana-common's ayatana-indicators.target with explicit Wants & Before to bring up requested indicator services
4041 systemd.user.targets =
4142 let
4242- indicatorServices = lib.lists.flatten (
4343- map (pkg: (map (ind: "${ind}.service") pkg.passthru.ayatana-indicators)) cfg.packages
4444- );
4343+ namesToServices = map (indicator: "${indicator}.service");
4444+ indicatorServices =
4545+ target:
4646+ lib.lists.flatten (
4747+ map (
4848+ pkg:
4949+ if lib.isList pkg.passthru.ayatana-indicators then
5050+ # Old format, add to every target
5151+ (lib.warn "${pkg.name} is using the old passthru.ayatana-indicators format, please update it!" (
5252+ namesToServices pkg.passthru.ayatana-indicators
5353+ ))
5454+ else
5555+ # New format, filter by target being mentioned
5656+ (namesToServices (
5757+ builtins.filter (
5858+ service:
5959+ builtins.any (
6060+ targetPrefix: "${targetPrefix}-indicators" == target
6161+ ) pkg.passthru.ayatana-indicators.${service}
6262+ ) (builtins.attrNames pkg.passthru.ayatana-indicators)
6363+ ))
6464+ ) cfg.packages
6565+ );
4566 in
4667 lib.attrsets.mapAttrs
4747- (_: desc: {
6868+ (name: desc: {
4869 description = "Target representing the lifecycle of the ${desc}. Each indicator should be bound to it in its individual service file";
4970 partOf = [ "graphical-session.target" ];
5050- wants = indicatorServices;
5151- before = indicatorServices;
7171+ wants = indicatorServices name;
7272+ before = indicatorServices name;
5273 })
5374 {
5475 ayatana-indicators = "Ayatana Indicators";