vuls: init at 0.27.0
[NixPkgs.git] / nixos / tests / maestral.nix
blob52cc32cd0f4bbc4205ad8c52b2563131f8716e4c
1 import ./make-test-python.nix ({ pkgs, ... }: {
2   name = "maestral";
3   meta = with pkgs.lib.maintainers; {
4     maintainers = [ peterhoeg ];
5   };
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;
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       };
29       gui = { ... }: common {
30         services.xserver = {
31           enable = true;
32           desktopManager.plasma5.enable = true;
33           desktopManager.plasma5.runUsingSystemd = true;
34         };
36         services.displayManager = {
37           sddm.enable = true;
38           defaultSession = "plasma";
39           autoLogin = {
40             enable = true;
41             user = "alice";
42           };
43         };
45         systemd.user.services = {
46           maestral = {
47             wantedBy = [ "graphical-session.target" ];
48             serviceConfig.ExecStart = "${pkgs.maestral-gui}/bin/maestral_qt";
49           };
50           # PowerDevil doesn't like our VM
51           plasma-powerdevil.enable = false;
52         };
53       };
54     };
56   testScript = { nodes, ... }:
57     let
58       user = nodes.cli.users.users.alice;
59     in
60     ''
61       start_all()
63       with subtest("CLI"):
64         # we need SOME way to give the user an active login session
65         cli.execute("loginctl enable-linger ${user.name}")
66         cli.systemctl("start user@${toString user.uid}")
67         cli.wait_for_unit("maestral.service", "${user.name}")
69       with subtest("GUI"):
70         gui.wait_for_x()
71         gui.wait_for_file("/tmp/xauth_*")
72         gui.succeed("xauth merge /tmp/xauth_*")
73         gui.wait_for_window("^Desktop ")
74         gui.wait_for_unit("maestral.service", "${user.name}")
75     '';