2023-10-20 09:50:27 +00:00
import ./make-test-python.nix ( { pkgs , lib , . . . }: let
user = " a l i c e " ;
in {
name = " a y a t a n a - i n d i c a t o r s " ;
meta = {
2024-01-02 17:33:16 +00:00
maintainers = lib . teams . lomiri . members ;
2023-10-20 09:50:27 +00:00
} ;
nodes . machine = { config , . . . }: {
imports = [
./common/auto.nix
./common/user-account.nix
] ;
test-support . displayManager . auto = {
enable = true ;
inherit user ;
} ;
services . xserver = {
enable = true ;
desktopManager . mate . enable = true ;
} ;
2024-02-27 20:28:05 +00:00
services . displayManager . defaultSession = lib . mkForce " m a t e " ;
2023-10-20 09:50:27 +00:00
services . ayatana-indicators = {
enable = true ;
packages = with pkgs ; [
2023-12-31 01:30:56 +00:00
ayatana-indicator-datetime
2023-10-20 09:50:27 +00:00
ayatana-indicator-messages
2024-04-18 16:33:32 +00:00
ayatana-indicator-power
2024-02-04 14:41:55 +00:00
ayatana-indicator-session
2024-01-02 17:33:16 +00:00
] ++ ( with pkgs . lomiri ; [
lomiri-indicator-network
2024-01-20 22:03:40 +00:00
telephony-service
2024-01-02 17:33:16 +00:00
] ) ;
2023-10-20 09:50:27 +00:00
} ;
2024-01-02 17:33:16 +00:00
# Setup needed by some indicators
2023-10-20 09:50:27 +00:00
services . accounts-daemon . enable = true ; # messages
2024-01-02 17:33:16 +00:00
# Lomiri-ish setup for Lomiri indicators
# TODO move into a Lomiri module, once the package set is far enough for the DE to start
networking . networkmanager . enable = true ; # lomiri-network-indicator
# TODO potentially urfkill for lomiri-network-indicator?
2024-01-20 22:03:40 +00:00
services . dbus . packages = with pkgs . lomiri ; [
libusermetrics
] ;
environment . systemPackages = with pkgs . lomiri ; [
lomiri-schemas
] ;
services . telepathy . enable = true ;
users . users . usermetrics = {
group = " u s e r m e t r i c s " ;
home = " / v a r / l i b / u s e r m e t r i c s " ;
createHome = true ;
isSystemUser = true ;
} ;
users . groups . usermetrics = { } ;
2023-10-20 09:50:27 +00:00
} ;
# TODO session indicator starts up in a semi-broken state, but works fine after a restart. maybe being started before graphical session is truly up & ready?
testScript = { nodes , . . . }: let
2024-01-02 17:33:16 +00:00
runCommandOverServiceList = list : command :
lib . strings . concatMapStringsSep " \n " command list ;
runCommandOverAyatanaIndicators = runCommandOverServiceList
( builtins . filter
( service : ! ( lib . strings . hasPrefix " l o m i r i " service || lib . strings . hasPrefix " t e l e p h o n y - s e r v i c e " service ) )
nodes . machine . systemd . user . targets . " a y a t a n a - i n d i c a t o r s " . wants ) ;
runCommandOverAllIndicators = runCommandOverServiceList
nodes . machine . systemd . user . targets . " a y a t a n a - i n d i c a t o r s " . wants ;
2023-10-20 09:50:27 +00:00
in ''
start_all ( )
machine . wait_for_x ( )
# Desktop environment should reach graphical-session.target
machine . wait_for_unit ( " g r a p h i c a l - s e s s i o n . t a r g e t " , " ${ user } " )
# MATE relies on XDG autostart to bring up the indicators.
# Not sure *when* XDG autostart fires them up, and awaiting pgrep success seems to misbehave?
machine . sleep ( 10 )
# Now check if all indicators were brought up successfully, and kill them for later
2024-01-02 17:33:16 +00:00
'' + ( r u n C o m m a n d O v e r A y a t a n a I n d i c a t o r s ( s e r v i c e : l e t s e r v i c e E x e c = b u i l t i n s . r e p l a c e S t r i n g s [ " . " ] [ " - " ] s e r v i c e ; i n ''
2023-12-31 01:30:56 +00:00
machine . succeed ( " p g r e p - u ${ user } - f ${ serviceExec } " )
2023-10-20 09:50:27 +00:00
machine . succeed ( " p k i l l - f ${ serviceExec } " )
'' ) ) + ''
# Ayatana target is the preferred way of starting up indicators on SystemD session, the graphical session is responsible for starting this if it supports them.
# Mate currently doesn't do this, so start it manually for checking (https://github.com/mate-desktop/mate-indicator-applet/issues/63)
machine . systemctl ( " s t a r t a y a t a n a - i n d i c a t o r s . t a r g e t " , " ${ user } " )
machine . wait_for_unit ( " a y a t a n a - i n d i c a t o r s . t a r g e t " , " ${ user } " )
# Let all indicator services do their startups, potential post-launch crash & restart cycles so we can properly check for failures
# Not sure if there's a better way of awaiting this without false-positive potential
machine . sleep ( 10 )
# Now check if all indicator services were brought up successfully
2024-01-02 17:33:16 +00:00
'' + r u n C o m m a n d O v e r A l l I n d i c a t o r s ( s e r v i c e : ''
2023-10-20 09:50:27 +00:00
machine . wait_for_unit ( " ${ service } " , " ${ user } " )
'' ) ;
} )