summary refs log tree commit diff
path: root/nixos/tests/retroarch.nix
diff options
context:
space:
mode:
authorJohannes Arnold <johannes.arnold@stud.uni-hannover.de>2022-02-05 00:50:11 +0100
committerJohannes Arnold <johannes.arnold@stud.uni-hannover.de>2022-02-08 20:52:02 +0100
commitd282f448ff74243ed1a1661c09ae27f010096cef (patch)
treef817903fc1c2e8501975d54eb98956468a0f663d /nixos/tests/retroarch.nix
parentf80278219f00b38762847049f6d482898051c2ca (diff)
downloadnixpkgs-d282f448ff74243ed1a1661c09ae27f010096cef.tar
nixpkgs-d282f448ff74243ed1a1661c09ae27f010096cef.tar.gz
nixpkgs-d282f448ff74243ed1a1661c09ae27f010096cef.tar.bz2
nixpkgs-d282f448ff74243ed1a1661c09ae27f010096cef.tar.lz
nixpkgs-d282f448ff74243ed1a1661c09ae27f010096cef.tar.xz
nixpkgs-d282f448ff74243ed1a1661c09ae27f010096cef.tar.zst
nixpkgs-d282f448ff74243ed1a1661c09ae27f010096cef.zip
nixos/retroarch: add RetroArch as a desktop session
Diffstat (limited to 'nixos/tests/retroarch.nix')
-rw-r--r--nixos/tests/retroarch.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/nixos/tests/retroarch.nix b/nixos/tests/retroarch.nix
new file mode 100644
index 00000000000..4c96f9eabc8
--- /dev/null
+++ b/nixos/tests/retroarch.nix
@@ -0,0 +1,49 @@
+import ./make-test-python.nix ({ pkgs, ... }:
+
+  {
+    name = "retroarch";
+    meta = with pkgs.lib.maintainers; { maintainers = [ j0hax ]; };
+
+    machine = { ... }:
+
+      {
+        imports = [ ./common/user-account.nix ];
+        services.xserver.enable = true;
+        services.xserver.desktopManager.retroarch = {
+          enable = true;
+          package = pkgs.retroarchFull;
+        };
+        services.xserver.displayManager = {
+          sddm.enable = true;
+          defaultSession = "RetroArch";
+          autoLogin = {
+            enable = true;
+            user = "alice";
+          };
+        };
+      };
+
+    testScript = { nodes, ... }:
+      let
+        user = nodes.machine.config.users.users.alice;
+        xdo = "${pkgs.xdotool}/bin/xdotool";
+      in ''
+        with subtest("Wait for login"):
+            start_all()
+            machine.wait_for_file("${user.home}/.Xauthority")
+            machine.succeed("xauth merge ${user.home}/.Xauthority")
+
+        with subtest("Check RetroArch started"):
+            machine.wait_until_succeeds("pgrep retroarch")
+            machine.wait_for_window("^RetroArch ")
+
+        with subtest("Check configuration created"):
+            machine.wait_for_file("${user.home}/.config/retroarch/retroarch.cfg")
+
+        with subtest("Wait to get a screenshot"):
+            machine.execute(
+                "${xdo} key Alt+F1 sleep 10"
+            )
+            machine.screenshot("screen")
+      '';
+  })