···
1
-
import ./make-test-python.nix (
5
-
mkConfig = name: keys: ''
7
-
import XMonad.Operations (restart)
8
-
import XMonad.Util.EZConfig
9
-
import XMonad.Util.SessionStart
10
-
import Control.Monad (when)
11
-
import Text.Printf (printf)
12
-
import System.Posix.Process (executeFile)
13
-
import System.Info (arch,os)
14
-
import System.Environment (getArgs)
15
-
import System.FilePath ((</>))
4
+
mkConfig = name: keys: ''
6
+
import XMonad.Operations (restart)
7
+
import XMonad.Util.EZConfig
8
+
import XMonad.Util.SessionStart
9
+
import Control.Monad (when)
10
+
import Text.Printf (printf)
11
+
import System.Posix.Process (executeFile)
12
+
import System.Info (arch,os)
13
+
import System.Environment (getArgs)
14
+
import System.FilePath ((</>))
18
-
dirs <- getDirectories
19
-
launch (def { startupHook = startup } `additionalKeysP` myKeys) dirs
17
+
dirs <- getDirectories
18
+
launch (def { startupHook = startup } `additionalKeysP` myKeys) dirs
21
-
startup = isSessionStart >>= \sessInit ->
22
-
spawn "touch /tmp/${name}"
23
-
>> if sessInit then setSessionStarted else spawn "xterm"
20
+
startup = isSessionStart >>= \sessInit ->
21
+
spawn "touch /tmp/${name}"
22
+
>> if sessInit then setSessionStarted else spawn "xterm"
25
-
myKeys = [${builtins.concatStringsSep ", " keys}]
24
+
myKeys = [${builtins.concatStringsSep ", " keys}]
27
-
compiledConfig = printf "xmonad-%s-%s" arch os
26
+
compiledConfig = printf "xmonad-%s-%s" arch os
29
-
compileRestart resume = do
30
-
dirs <- asks directories
28
+
compileRestart resume = do
29
+
dirs <- asks directories
32
-
whenX (recompile dirs True) $
33
-
when resume writeStateToFile
37
-
executeFile (cacheDir dirs </> compiledConfig) False args Nothing
31
+
whenX (recompile dirs True) $
32
+
when resume writeStateToFile
36
+
executeFile (cacheDir dirs </> compiledConfig) False args Nothing
42
-
''("M-C-x", spawn "xterm")''
43
-
''("M-q", restart "xmonad" True)''
44
-
''("M-C-q", compileRestart True)''
45
-
''("M-C-t", spawn "touch /tmp/somefile")'' # create somefile
41
+
''("M-C-x", spawn "xterm")''
42
+
''("M-q", restart "xmonad" True)''
43
+
''("M-C-q", compileRestart True)''
44
+
''("M-C-t", spawn "touch /tmp/somefile")'' # create somefile
49
-
''("M-C-x", spawn "xterm")''
50
-
''("M-q", restart "xmonad" True)''
51
-
''("M-C-q", compileRestart True)''
52
-
''("M-C-r", spawn "rm /tmp/somefile")'' # delete somefile
48
+
''("M-C-x", spawn "xterm")''
49
+
''("M-q", restart "xmonad" True)''
50
+
''("M-C-q", compileRestart True)''
51
+
''("M-C-r", spawn "rm /tmp/somefile")'' # delete somefile
54
+
newConfig = pkgs.writeText "xmonad.hs" (mkConfig "newXMonad" newKeys);
58
+
meta = with pkgs.lib.maintainers; {
55
-
newConfig = pkgs.writeText "xmonad.hs" (mkConfig "newXMonad" newKeys);
59
-
meta = with pkgs.lib.maintainers; {
70
+
./common/user-account.nix
72
+
test-support.displayManager.auto.user = "alice";
73
+
services.displayManager.defaultSession = "none+xmonad";
74
+
services.xserver.windowManager.xmonad = {
76
+
enableConfiguredRecompile = true;
77
+
enableContribAndExtras = true;
78
+
extraPackages = with pkgs.haskellPackages; haskellPackages: [ xmobar ];
79
+
config = mkConfig "oldXMonad" oldKeys;
71
-
./common/user-account.nix
73
-
test-support.displayManager.auto.user = "alice";
74
-
services.displayManager.defaultSession = "none+xmonad";
75
-
services.xserver.windowManager.xmonad = {
77
-
enableConfiguredRecompile = true;
78
-
enableContribAndExtras = true;
79
-
extraPackages = with pkgs.haskellPackages; haskellPackages: [ xmobar ];
80
-
config = mkConfig "oldXMonad" oldKeys;
87
-
user = nodes.machine.config.users.users.alice;
90
-
machine.wait_for_x()
91
-
machine.wait_for_file("${user.home}/.Xauthority")
92
-
machine.succeed("xauth merge ${user.home}/.Xauthority")
93
-
machine.send_key("alt-ctrl-x")
94
-
machine.wait_for_window("${user.name}.*machine")
96
-
machine.screenshot("terminal1")
97
-
machine.succeed("rm /tmp/oldXMonad")
98
-
machine.send_key("alt-q")
99
-
machine.wait_for_file("/tmp/oldXMonad")
100
-
machine.wait_for_window("${user.name}.*machine")
102
-
machine.screenshot("terminal2")
86
+
user = nodes.machine.users.users.alice;
89
+
machine.wait_for_x()
90
+
machine.wait_for_file("${user.home}/.Xauthority")
91
+
machine.succeed("xauth merge ${user.home}/.Xauthority")
92
+
machine.send_key("alt-ctrl-x")
93
+
machine.wait_for_window("${user.name}.*machine")
95
+
machine.screenshot("terminal1")
96
+
machine.succeed("rm /tmp/oldXMonad")
97
+
machine.send_key("alt-q")
98
+
machine.wait_for_file("/tmp/oldXMonad")
99
+
machine.wait_for_window("${user.name}.*machine")
101
+
machine.screenshot("terminal2")
104
-
# /tmp/somefile should not exist yet
105
-
machine.fail("stat /tmp/somefile")
103
+
# /tmp/somefile should not exist yet
104
+
machine.fail("stat /tmp/somefile")
107
-
# original config has a keybinding that creates somefile
108
-
machine.send_key("alt-ctrl-t")
109
-
machine.wait_for_file("/tmp/somefile")
106
+
# original config has a keybinding that creates somefile
107
+
machine.send_key("alt-ctrl-t")
108
+
machine.wait_for_file("/tmp/somefile")
111
-
# set up the new config
112
-
machine.succeed("mkdir -p ${user.home}/.xmonad")
113
-
machine.copy_from_host("${newConfig}", "${user.home}/.config/xmonad/xmonad.hs")
110
+
# set up the new config
111
+
machine.succeed("mkdir -p ${user.home}/.xmonad")
112
+
machine.copy_from_host("${newConfig}", "${user.home}/.config/xmonad/xmonad.hs")
115
-
# recompile xmonad using the new config
116
-
machine.send_key("alt-ctrl-q")
117
-
machine.wait_for_file("/tmp/newXMonad")
114
+
# recompile xmonad using the new config
115
+
machine.send_key("alt-ctrl-q")
116
+
machine.wait_for_file("/tmp/newXMonad")
119
-
# new config has a keybinding that deletes somefile
120
-
machine.send_key("alt-ctrl-r")
121
-
machine.wait_until_fails("stat /tmp/somefile", timeout=30)
118
+
# new config has a keybinding that deletes somefile
119
+
machine.send_key("alt-ctrl-r")
120
+
machine.wait_until_fails("stat /tmp/somefile", timeout=30)
123
-
# restart with the old config, and confirm the old keybinding is back
124
-
machine.succeed("rm /tmp/oldXMonad")
125
-
machine.send_key("alt-q")
126
-
machine.wait_for_file("/tmp/oldXMonad")
127
-
machine.send_key("alt-ctrl-t")
128
-
machine.wait_for_file("/tmp/somefile")
122
+
# restart with the old config, and confirm the old keybinding is back
123
+
machine.succeed("rm /tmp/oldXMonad")
124
+
machine.send_key("alt-q")
125
+
machine.wait_for_file("/tmp/oldXMonad")
126
+
machine.send_key("alt-ctrl-t")
127
+
machine.wait_for_file("/tmp/somefile")