1import ./make-test-python.nix (
2 { pkgs, ... }:
3 {
4 name = "maestral";
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ peterhoeg ];
7 };
8
9 nodes =
10 let
11 common =
12 attrs:
13 pkgs.lib.recursiveUpdate {
14 imports = [ ./common/user-account.nix ];
15 systemd.user.services.maestral = {
16 description = "Maestral Dropbox Client";
17 serviceConfig.Type = "exec";
18 };
19 } attrs;
20
21 in
22 {
23 cli =
24 { ... }:
25 common {
26 systemd.user.services.maestral = {
27 wantedBy = [ "default.target" ];
28 serviceConfig.ExecStart = "${pkgs.maestral}/bin/maestral start --foreground";
29 };
30 };
31
32 gui =
33 { ... }:
34 common {
35 services.xserver = {
36 enable = true;
37 desktopManager.plasma5.enable = true;
38 desktopManager.plasma5.runUsingSystemd = true;
39 };
40
41 services.displayManager = {
42 sddm.enable = true;
43 defaultSession = "plasma";
44 autoLogin = {
45 enable = true;
46 user = "alice";
47 };
48 };
49
50 systemd.user.services = {
51 maestral = {
52 wantedBy = [ "graphical-session.target" ];
53 serviceConfig.ExecStart = "${pkgs.maestral-gui}/bin/maestral_qt";
54 };
55 # PowerDevil doesn't like our VM
56 plasma-powerdevil.enable = false;
57 };
58 };
59 };
60
61 testScript =
62 { nodes, ... }:
63 let
64 user = nodes.cli.users.users.alice;
65 in
66 ''
67 start_all()
68
69 with subtest("CLI"):
70 # we need SOME way to give the user an active login session
71 cli.execute("loginctl enable-linger ${user.name}")
72 cli.systemctl("start user@${toString user.uid}")
73 cli.wait_for_unit("maestral.service", "${user.name}")
74
75 with subtest("GUI"):
76 gui.wait_for_x()
77 gui.wait_for_file("/tmp/xauth_*")
78 gui.succeed("xauth merge /tmp/xauth_*")
79 gui.wait_for_window("^Desktop ")
80 gui.wait_for_unit("maestral.service", "${user.name}")
81 '';
82 }
83)