summaryrefslogtreecommitdiffstats
path: root/nixos/tests/xmonad-xdg-autostart.nix
blob: 76ea97c6a0c10aa814c7242e489115c6c05ab466 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{ 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.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.users.users.alice;
    in
    ''
      machine.wait_for_x()
      machine.wait_for_file("${user.home}/xdg-autostart-executed")
    '';
}