diff --git a/nixos/release-combined.nix b/nixos/release-combined.nix index 9e2109d88b5fc..338110373e326 100644 --- a/nixos/release-combined.nix +++ b/nixos/release-combined.nix @@ -69,8 +69,9 @@ in rec { (all nixos.tests.firefox) (all nixos.tests.firewall) (all nixos.tests.fontconfig-default-fonts) - (all nixos.tests.gnome3-xorg) (all nixos.tests.gnome3) + (all nixos.tests.gnome3-flashback.metacity) + (all nixos.tests.gnome3-xorg) (all nixos.tests.pantheon) nixos.tests.installer.zfsroot.x86_64-linux or [] # ZFS is 64bit only (except ["aarch64-linux"] nixos.tests.installer.lvm) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 5e7c8a7f4b5fd..01833e392cabe 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -102,9 +102,10 @@ in gjs = handleTest ./gjs.nix {}; glib-networking = handleTest ./glib-networking.nix {}; glusterfs = handleTest ./glusterfs.nix {}; - gnome3-xorg = handleTest ./gnome3-xorg.nix {}; - gnome3 = handleTest ./gnome3.nix {}; gnome-photos = handleTest ./gnome-photos.nix {}; + gnome3 = handleTest ./gnome3 {}; + gnome3-flashback = pkgs.recurseIntoAttrs (handleTest ./gnome3/flashback.nix {}); + gnome3-xorg = handleTest ./gnome3/xorg.nix {}; gocd-agent = handleTest ./gocd-agent.nix {}; gocd-server = handleTest ./gocd-server.nix {}; google-oslogin = handleTest ./google-oslogin {}; diff --git a/nixos/tests/gnome3.nix b/nixos/tests/gnome3/default.nix similarity index 95% rename from nixos/tests/gnome3.nix rename to nixos/tests/gnome3/default.nix index ab363efb6a197..afccf2d0a1704 100644 --- a/nixos/tests/gnome3.nix +++ b/nixos/tests/gnome3/default.nix @@ -1,4 +1,4 @@ -import ./make-test.nix ({ pkgs, ...} : { +import ../make-test.nix ({ pkgs, ...} : { name = "gnome3"; meta = with pkgs.stdenv.lib.maintainers; { maintainers = pkgs.gnome3.maintainers; @@ -7,7 +7,7 @@ import ./make-test.nix ({ pkgs, ...} : { machine = { ... }: - { imports = [ ./common/user-account.nix ]; + { imports = [ ../common/user-account.nix ]; services.xserver.enable = true; diff --git a/nixos/tests/gnome3/flashback.nix b/nixos/tests/gnome3/flashback.nix new file mode 100644 index 0000000000000..94977c4adb835 --- /dev/null +++ b/nixos/tests/gnome3/flashback.nix @@ -0,0 +1,98 @@ +# GNOME Flashback Terminal tests for various custom sessions. + +{ system ? builtins.currentSystem, + config ? {}, + pkgs ? import ../../.. { inherit system config; } +}: + +with import ../../lib/testing.nix { inherit system pkgs; }; +with pkgs.lib; + +let + + baseConfig = { + imports = [ ../common/user-account.nix ]; + + services.xserver.enable = true; + + # See: https://github.com/NixOS/nixpkgs/issues/66443 + services.xserver.displayManager.gdm.enable = false; + services.xserver.displayManager.lightdm.enable = true; + services.xserver.displayManager.lightdm.autoLogin.enable = true; + services.xserver.displayManager.lightdm.autoLogin.user = "alice"; + services.xserver.desktopManager.gnome3.enable = true; + + virtualisation.memorySize = 2047; + }; + + makeFlashbackTest = + { wmName + , wmLabel ? "" + , wmCommand ? "" + , useMetacity ? false + }: + makeTest rec { + name = "gnome-flashback-${wmName}"; + + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = pkgs.gnome3.maintainers; + }; + + machine = { ... }: { + imports = [ baseConfig ]; + + services.xserver.desktopManager.default = "gnome-flashback-${wmName}"; + + services.xserver.desktopManager.gnome3.flashback = { + enableMetacity = useMetacity; + + customSessions = mkIf (!useMetacity) [ + { inherit wmName wmLabel wmCommand; } + ]; + }; + + }; + + testScript = + '' + $machine->waitForX; + + # wait for alice to be logged in + $machine->waitForUnit("default.target","alice"); + + # Check that logging in has given the user ownership of devices. + $machine->succeed("getfacl -p /dev/snd/timer | grep -q alice"); + + $machine->succeed("su - alice -c 'DISPLAY=:0.0 gnome-terminal &'"); + $machine->succeed("xauth merge ~alice/.Xauthority"); + $machine->waitForWindow(qr/alice.*machine/); + $machine->succeed("timeout 900 bash -c 'while read msg; do if [[ \$msg =~ \"GNOME Shell started\" ]]; then break; fi; done < <(journalctl -f)'"); + $machine->sleep(10); + $machine->screenshot("screen"); + ''; + }; + +in + +{ + + metacity = makeFlashbackTest { + useMetacity = true; + wmName = "metacity"; + }; + + # TODO: These are currently broken with gnome-session 3.34 + # See: https://github.com/NixOS/nixpkgs/pull/71212#issuecomment-544303107 + # i3 = makeFlashbackTest { + # wmName = "i3"; + # wmLabel = "i3"; + # wmCommand = "${pkgs.i3}/bin/i3"; + # }; + + # xmonad = makeFlashbackTest { + # wmName = "xmonad"; + # wmLabel = "XMonad"; + # wmCommand = "${pkgs.haskellPackages.xmonad}/bin/xmonad"; + # }; + +} diff --git a/nixos/tests/gnome3-xorg.nix b/nixos/tests/gnome3/xorg.nix similarity index 89% rename from nixos/tests/gnome3-xorg.nix rename to nixos/tests/gnome3/xorg.nix index eb4c376319be2..c6ca892e3ce91 100644 --- a/nixos/tests/gnome3-xorg.nix +++ b/nixos/tests/gnome3/xorg.nix @@ -1,4 +1,4 @@ -import ./make-test.nix ({ pkgs, ...} : { +import ../make-test.nix ({ pkgs, ...} : { name = "gnome3-xorg"; meta = with pkgs.stdenv.lib.maintainers; { maintainers = pkgs.gnome3.maintainers; @@ -7,10 +7,11 @@ import ./make-test.nix ({ pkgs, ...} : { machine = { ... }: - { imports = [ ./common/user-account.nix ]; + { imports = [ ../common/user-account.nix ]; services.xserver.enable = true; + # See: https://github.com/NixOS/nixpkgs/issues/66443 services.xserver.displayManager.gdm.enable = false; services.xserver.displayManager.lightdm.enable = true; services.xserver.displayManager.lightdm.autoLogin.enable = true;