Skip to content

Commit

Permalink
Merge pull request #151902 from primeos/sway
Browse files Browse the repository at this point in the history
sway: 1.6.1 -> 1.7
  • Loading branch information
primeos authored Jan 23, 2022
2 parents 64a18f1 + 2e719d1 commit a3d847c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 24 deletions.
4 changes: 2 additions & 2 deletions nixos/modules/programs/sway.nix
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ in {
extraPackages = mkOption {
type = with types; listOf package;
default = with pkgs; [
swaylock swayidle alacritty dmenu
swaylock swayidle foot dmenu
];
defaultText = literalExpression ''
with pkgs; [ swaylock swayidle alacritty dmenu ];
with pkgs; [ swaylock swayidle foot dmenu ];
'';
example = literalExpression ''
with pkgs; [
Expand Down
47 changes: 32 additions & 15 deletions nixos/tests/sway.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import ./make-test-python.nix ({ pkgs, lib, ...} :
import ./make-test-python.nix ({ pkgs, lib, ... }:

{
name = "sway";
Expand All @@ -13,19 +13,38 @@ import ./make-test-python.nix ({ pkgs, lib, ...} :

environment = {
# For glinfo and wayland-info:
systemPackages = with pkgs; [ mesa-demos wayland-utils ];
systemPackages = with pkgs; [ mesa-demos wayland-utils alacritty ];
# Use a fixed SWAYSOCK path (for swaymsg):
variables = {
"SWAYSOCK" = "/tmp/sway-ipc.sock";
"WLR_RENDERER_ALLOW_SOFTWARE" = "1";
# 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 | head -n 3 | tee /tmp/test-x11.out && touch /tmp/test-x11-exit-ok";
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;
};
};
};

fonts.fonts = [ pkgs.inconsolata ];

# Automatically configure and start Sway when logging in on tty1:
programs.bash.loginShellInit = ''
if [ "$(tty)" = "/dev/tty1" ]; then
Expand Down Expand Up @@ -61,29 +80,30 @@ import ./make-test-python.nix ({ pkgs, lib, ...} :
machine.wait_for_file("/run/user/1000/wayland-1")
machine.wait_for_file("/tmp/sway-ipc.sock")
# Test XWayland:
# Test XWayland (foot does not support X):
machine.succeed(
"su - alice -c 'swaymsg exec WINIT_UNIX_BACKEND=x11 WAYLAND_DISPLAY=invalid alacritty'"
)
machine.wait_for_text("alice@machine")
machine.send_chars("test-x11\n")
machine.wait_for_file("/tmp/test-x11-exit-ok")
print(machine.succeed("cat /tmp/test-x11.out"))
machine.copy_from_vm("/tmp/test-x11.out")
machine.screenshot("alacritty_glinfo")
machine.succeed("pkill alacritty")
# Start a terminal (Alacritty) on workspace 3:
# Start a terminal (foot) on workspace 3:
machine.send_key("alt-3")
machine.succeed(
"su - alice -c 'swaymsg exec WINIT_UNIX_BACKEND=wayland DISPLAY=invalid alacritty'"
)
machine.sleep(3)
machine.send_key("alt-ret")
machine.wait_for_text("alice@machine")
machine.send_chars("test-wayland\n")
machine.wait_for_file("/tmp/test-wayland-exit-ok")
print(machine.succeed("cat /tmp/test-wayland.out"))
machine.screenshot("alacritty_wayland_info")
machine.copy_from_vm("/tmp/test-wayland.out")
machine.screenshot("foot_wayland_info")
machine.send_key("alt-shift-q")
machine.wait_until_fails("pgrep alacritty")
machine.wait_until_fails("pgrep foot")
# Test gpg-agent starting pinentry-gnome3 via D-Bus (tests if
# $WAYLAND_DISPLAY is correctly imported into the D-Bus user env):
Expand All @@ -104,9 +124,6 @@ import ./make-test-python.nix ({ pkgs, lib, ...} :
# Exit Sway and verify process exit status 0:
machine.succeed("su - alice -c 'swaymsg exit || true'")
machine.wait_until_fails("pgrep -x sway")
# TODO: Sway currently segfaults after "swaymsg exit" but only in this VM test:
# machine # [ 104.090032] sway[921]: segfault at 3f800008 ip 00007f7dbdc25f10 sp 00007ffe282182f8 error 4 in libwayland-server.so.0.1.0[7f7dbdc1f000+8000]
# machine.wait_for_file("/tmp/sway-exit-ok")
machine.wait_for_file("/tmp/sway-exit-ok")
'';
})
8 changes: 4 additions & 4 deletions pkgs/applications/window-managers/sway/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ lib, stdenv, fetchFromGitHub, substituteAll, swaybg
, meson, ninja, pkg-config, wayland-scanner, scdoc
, meson_0_60, ninja, pkg-config, wayland-scanner, scdoc
, wayland, libxkbcommon, pcre, json_c, dbus, libevdev
, pango, cairo, libinput, libcap, pam, gdk-pixbuf, librsvg
, wlroots, wayland-protocols, libdrm
Expand All @@ -12,13 +12,13 @@

stdenv.mkDerivation rec {
pname = "sway-unwrapped";
version = "1.6.1";
version = "1.7";

src = fetchFromGitHub {
owner = "swaywm";
repo = "sway";
rev = version;
sha256 = "0j4sdbsrlvky1agacc0pcz9bwmaxjmrapjnzscbd2i0cria2fc5j";
sha256 = "0ss3l258blyf2d0lwd7pi7ga1fxfj8pxhag058k7cmjhs3y30y5l";
};

patches = [
Expand All @@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
];

nativeBuildInputs = [
meson ninja pkg-config wayland-scanner scdoc
meson_0_60 ninja pkg-config wayland-scanner scdoc
];

buildInputs = [
Expand Down
4 changes: 1 addition & 3 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26251,9 +26251,7 @@ with pkgs;
inherit (xorg) xcbutilrenderutil;
};

sway-unwrapped = callPackage ../applications/window-managers/sway {
wlroots = wlroots_0_14;
};
sway-unwrapped = callPackage ../applications/window-managers/sway { };
sway = callPackage ../applications/window-managers/sway/wrapper.nix { };
swaybg = callPackage ../applications/window-managers/sway/bg.nix { };
swayidle = callPackage ../applications/window-managers/sway/idle.nix { };
Expand Down

0 comments on commit a3d847c

Please sign in to comment.