nixpkgs/nixos/tests/xmonad-xdg-autostart.nix
oxalica 45ba086ea5 nixos/desktop-manager/none: add option to run XDG autostart files
`fcitx5` and `service.earlyoom` rely on use XDG autostart files to start.
But for X session with only window manager and no desktop manager
(`none` is used), no one can start them.

This options is added to run these autostart files for sessions without
desktop manager to make other services just work.
2022-04-18 01:13:59 +08:00

36 lines
1.1 KiB
Nix

import ./make-test-python.nix ({ lib, ... }: {
name = "xmonad-xdg-autostart";
meta.maintainers = with lib.maintainers; [ oxalica ];
nodes.machine = { pkgs, config, ... }: {
imports = [ ./common/x11.nix ./common/user-account.nix ];
test-support.displayManager.auto.user = "alice";
services.xserver.displayManager.defaultSession = "none+xmonad";
services.xserver.windowManager.xmonad.enable = true;
services.xserver.desktopManager.runXdgAutostartIfNone = true;
environment.systemPackages = [
(pkgs.writeTextFile {
name = "test-xdg-autostart";
destination = "/etc/xdg/autostart/test-xdg-autostart.desktop";
text = ''
[Desktop Entry]
Name=test-xdg-autoatart
Type=Application
Terminal=false
Exec=${pkgs.coreutils}/bin/touch ${config.users.users.alice.home}/xdg-autostart-executed
'';
})
];
};
testScript = { nodes, ... }:
let
user = nodes.machine.config.users.users.alice;
in
''
machine.wait_for_x()
machine.wait_for_file("${user.home}/xdg-autostart-executed")
'';
})