diff --git a/nixos/tests/swayfx.nix b/nixos/tests/swayfx.nix index fe1caf8fffa8..ba8408e20460 100644 --- a/nixos/tests/swayfx.nix +++ b/nixos/tests/swayfx.nix @@ -12,80 +12,78 @@ import ./make-test-python.nix ( # Found 1 error in 1 file (checked 1 source file) skipTypeCheck = true; - nodes.machine = - { config, ... }: - { - # Automatically login on tty1 as a normal user: - imports = [ ./common/user-account.nix ]; - services.getty.autologinUser = "alice"; + nodes.machine = { + # Automatically login on tty1 as a normal user: + imports = [ ./common/user-account.nix ]; + services.getty.autologinUser = "alice"; - environment = { - # For glinfo and wayland-info: - systemPackages = with pkgs; [ - mesa-demos - wayland-utils - alacritty - ]; - # Use a fixed SWAYSOCK path (for swaymsg): - variables = { - "SWAYSOCK" = "/tmp/sway-ipc.sock"; - # TODO: Investigate if we can get hardware acceleration to work (via - # virtio-gpu and Virgil). We currently have to use the Pixman software - # renderer since the GLES2 renderer doesn't work inside the VM (even - # with WLR_RENDERER_ALLOW_SOFTWARE): - # "WLR_RENDERER_ALLOW_SOFTWARE" = "1"; - "WLR_RENDERER" = "pixman"; - }; - # For convenience: - shellAliases = { - test-x11 = "glinfo | tee /tmp/test-x11.out && touch /tmp/test-x11-exit-ok"; - test-wayland = "wayland-info | tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok"; - }; - - # To help with OCR: - etc."xdg/foot/foot.ini".text = lib.generators.toINI { } { - main = { - font = "inconsolata:size=14"; - }; - colors = rec { - foreground = "000000"; - background = "ffffff"; - regular2 = foreground; - }; - }; - - etc."gpg-agent.conf".text = '' - pinentry-timeout 86400 - ''; + environment = { + # For glinfo and wayland-info: + systemPackages = with pkgs; [ + mesa-demos + wayland-utils + alacritty + ]; + # Use a fixed SWAYSOCK path (for swaymsg): + variables = { + "SWAYSOCK" = "/tmp/sway-ipc.sock"; + # TODO: Investigate if we can get hardware acceleration to work (via + # virtio-gpu and Virgil). We currently have to use the Pixman software + # renderer since the GLES2 renderer doesn't work inside the VM (even + # with WLR_RENDERER_ALLOW_SOFTWARE): + # "WLR_RENDERER_ALLOW_SOFTWARE" = "1"; + "WLR_RENDERER" = "pixman"; + }; + # For convenience: + shellAliases = { + test-x11 = "glinfo | tee /tmp/test-x11.out && touch /tmp/test-x11-exit-ok"; + test-wayland = "wayland-info | tee /tmp/test-wayland.out && touch /tmp/test-wayland-exit-ok"; }; - fonts.packages = [ pkgs.inconsolata ]; + # To help with OCR: + etc."xdg/foot/foot.ini".text = lib.generators.toINI { } { + main = { + font = "inconsolata:size=14"; + }; + colors = rec { + foreground = "000000"; + background = "ffffff"; + regular2 = foreground; + }; + }; - # Automatically configure and start Sway when logging in on tty1: - programs.bash.loginShellInit = '' - if [ "$(tty)" = "/dev/tty1" ]; then - set -e - - mkdir -p ~/.config/sway - sed s/Mod4/Mod1/ /etc/sway/config > ~/.config/sway/config - - sway --validate - sway && touch /tmp/sway-exit-ok - fi + etc."gpg-agent.conf".text = '' + pinentry-timeout 86400 ''; - - programs.sway = { - enable = true; - package = pkgs.swayfx.override { isNixOS = true; }; - }; - - # To test pinentry via gpg-agent: - programs.gnupg.agent.enable = true; - - # Need to switch to a different GPU driver than the default one (-vga std) so that Sway can launch: - virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ]; }; + fonts.packages = [ pkgs.inconsolata ]; + + # Automatically configure and start Sway when logging in on tty1: + programs.bash.loginShellInit = '' + if [ "$(tty)" = "/dev/tty1" ]; then + set -e + + mkdir -p ~/.config/sway + sed s/Mod4/Mod1/ /etc/sway/config > ~/.config/sway/config + + sway --validate + sway && touch /tmp/sway-exit-ok + fi + ''; + + programs.sway = { + enable = true; + package = pkgs.swayfx.override { isNixOS = true; }; + }; + + # To test pinentry via gpg-agent: + programs.gnupg.agent.enable = true; + + # Need to switch to a different GPU driver than the default one (-vga std) so that Sway can launch: + virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ]; + }; + testScript = { nodes, ... }: '' @@ -194,7 +192,7 @@ import ./make-test-python.nix ( swaymsg("exec swaylock") machine.wait_until_succeeds("pgrep -x swaylock") machine.sleep(3) - machine.send_chars("${nodes.machine.config.users.users.alice.password}") + machine.send_chars("${nodes.machine.users.users.alice.password}") machine.send_key("ret") machine.wait_until_fails("pgrep -x swaylock") diff --git a/pkgs/by-name/sw/swayfx-unwrapped/package.nix b/pkgs/by-name/sw/swayfx-unwrapped/package.nix index f771a0101e24..9e621c41ccaf 100644 --- a/pkgs/by-name/sw/swayfx-unwrapped/package.nix +++ b/pkgs/by-name/sw/swayfx-unwrapped/package.nix @@ -33,6 +33,7 @@ enableXWayland ? true, systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd, trayEnabled ? systemdSupport, + fetchpatch2, }: stdenv.mkDerivation (finalAttrs: { @@ -57,6 +58,12 @@ stdenv.mkDerivation (finalAttrs: { [ ./load-configuration-from-etc.patch + (fetchpatch2 { + # fix missing switch statement for newer libinput + url = "https://github.com/swaywm/sway/pull/8470.patch?full_index=1"; + hash = "sha256-UTZ2DNEsGi5RYrgZThHkYz3AnnIl/KxieinA1WUZRq4="; + }) + (substituteAll { src = ./fix-paths.patch; inherit swaybg;