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