Fix sway screensharing issues

This commit is contained in:
Riley Apeldoorn 2023-06-06 16:05:51 +02:00
parent f1c97bd095
commit a21a4d5e26
6 changed files with 68 additions and 42 deletions

View file

@ -3,8 +3,7 @@
{ {
imports = [ imports = [
./gui/pipewire.nix ./gui.nix
./gui/sway.nix
./nix.nix ./nix.nix
./ssh.nix ./ssh.nix
]; ];

57
shared/core/gui.nix Normal file
View file

@ -0,0 +1,57 @@
# Almost everything in this file is required to get screen sharing on sway
# to work properly. The rest is required to get sway to work at all.
{ pkgs, config, lib, ... }:
let cfg = config.custom.gui;
in {
options.custom.gui = {
enable = lib.mkEnableOption "Nix-managed GUI services";
};
config = lib.mkIf (cfg.enable) {
hardware.opengl.enable = true;
hardware.nvidia.modesetting.enable = true;
security.rtkit.enable = true;
services.xserver = {
enable = true;
displayManager.gdm.enable = true;
videoDrivers = [ "nvidia" ];
};
services.pipewire = {
enable = true;
pulse.enable = true;
wireplumber.enable = true;
};
services.dbus.enable = true;
programs.sway = {
enable = true;
extraPackages = [
pkgs.vulkan-validation-layers
];
};
xdg.portal = {
enable = true;
wlr.enable = true;
extraPortals = [
pkgs.xdg-desktop-portal-kde
];
};
environment.systemPackages = with pkgs; [
brightnessctl
mesa
polkit_gnome
vulkan-tools
xdg-desktop-portal-wlr
];
};
}

View file

@ -1,24 +0,0 @@
{ pkgs, lib, config, ... }:
let cfg = config.custom.gui.pipewire;
in with lib; {
options.custom.gui.pipewire = {
enable = mkEnableOption "pipewire";
};
config = mkIf (cfg.enable) {
environment.defaultPackages = with pkgs; [
pavucontrol
];
services.pipewire = {
enable = true;
pulse.enable = true;
};
};
}

View file

@ -1,10 +0,0 @@
{ ... }: {
hardware.opengl.enable = true;
services.xserver.enable = true;
services.xserver.displayManager.gdm = {
enable = true;
};
programs.sway.enable = true;
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia.modesetting.enable = true;
}

View file

@ -47,15 +47,19 @@ in with lib; {
'') '')
]; ];
# programs.swaylock.enable = true;
# services.swayidle.enable = true;
programs.waybar.enable = true; programs.waybar.enable = true;
wayland.windowManager.sway = { wayland.windowManager.sway = {
# This is all required to get it to not die. # This is all required to get it to not die.
enable = true; enable = true;
extraSessionCommands = "export WLR_NO_HARDWARE_CURSORS=1"; wrapperFeatures.gtk = true;
extraSessionCommands = ''
export WLR_NO_HARDWARE_CURSORS=1;
export WLR_RENDERER=vulkan;
export WLR_EGL_NO_MODIFIERS=1;
'';
extraOptions = [ "--unsupported-gpu" ]; extraOptions = [ "--unsupported-gpu" ];
systemdIntegration = true;
config = rec { config = rec {
output."*".bg = "${../../data/wallpaper.jpg} fill"; output."*".bg = "${../../data/wallpaper.jpg} fill";
@ -93,8 +97,8 @@ in with lib; {
"${mod}+q" = "exec ${pkgs.foot}/bin/foot"; "${mod}+q" = "exec ${pkgs.foot}/bin/foot";
"${mod}+Return" = "exec ${terminal}"; "${mod}+Return" = "exec ${terminal}";
"${mod}+Escape" = "exec swaylock"; "${mod}+Escape" = "exec swaylock";
"${mod}+Tab" = "exec ${pkgs.firefox}/bin/firefox"; "${mod}+Tab" = "exec ${pkgs.firefox-wayland}/bin/firefox";
"${mod}+Alt+Tab" = "exec ${pkgs.google-chrome}/bin/google-chrome-stable"; "${mod}+Alt+Tab" = "exec ${pkgs.google-chrome}/bin/google-chrome-stable --ozone-platform-hint=auto --enable-features=VaapiVideoDecoder,VaapiVideoEncoder";
"${mod}+Backspace" = "mode kill"; "${mod}+Backspace" = "mode kill";
} }

View file

@ -1,7 +1,7 @@
{ ... }: { { ... }: {
custom = { custom = {
gui.pipewire.enable = true; gui.enable = true;
}; };
system.stateVersion = "21.11"; system.stateVersion = "21.11";