Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swayfx-unwrapped: backport fix to support updated libinput #376189

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 62 additions & 64 deletions nixos/tests/swayfx.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";

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";
};
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;
};
# 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
'';
};

fonts.packages = [ pkgs.inconsolata ];

# Automatically configure and start Sway when logging in on tty1:
programs.bash.loginShellInit = ''
if [ "$(tty)" = "/dev/tty1" ]; then
set -e
etc."gpg-agent.conf".text = ''
pinentry-timeout 86400
'';
};

mkdir -p ~/.config/sway
sed s/Mod4/Mod1/ /etc/sway/config > ~/.config/sway/config
fonts.packages = [ pkgs.inconsolata ];

sway --validate
sway && touch /tmp/sway-exit-ok
fi
'';
# Automatically configure and start Sway when logging in on tty1:
programs.bash.loginShellInit = ''
if [ "$(tty)" = "/dev/tty1" ]; then
set -e

programs.sway = {
enable = true;
package = pkgs.swayfx.override { isNixOS = true; };
};
mkdir -p ~/.config/sway
sed s/Mod4/Mod1/ /etc/sway/config > ~/.config/sway/config

# To test pinentry via gpg-agent:
programs.gnupg.agent.enable = true;
sway --validate
sway && touch /tmp/sway-exit-ok
fi
'';

# 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" ];
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, ... }:
''
Expand Down Expand Up @@ -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")

Expand Down
7 changes: 7 additions & 0 deletions pkgs/by-name/sw/swayfx-unwrapped/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
enableXWayland ? true,
systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd,
trayEnabled ? systemdSupport,
fetchpatch2,
}:

stdenv.mkDerivation (finalAttrs: {
Expand All @@ -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;
Expand Down