sway: use vulkan renderer on NVidia GPU

This commit is contained in:
Victor Mignot 2024-02-23 22:18:06 +01:00
parent fea78e7fc1
commit 590dbd8706
Signed by: dala
GPG key ID: 5E7F2CE1BEAFED3D
4 changed files with 16 additions and 3 deletions

View file

@ -22,6 +22,11 @@ with lib;
(mkIf (config.hwAccelerationGPU == "intel") intel-compute-runtime) (mkIf (config.hwAccelerationGPU == "intel") intel-compute-runtime)
(mkIf (config.hwAccelerationGPU == "nvidia") libvdpau-va-gl) (mkIf (config.hwAccelerationGPU == "nvidia") libvdpau-va-gl)
(mkIf (config.hwAccelerationGPU == "nvidia") vaapiVdpau) (mkIf (config.hwAccelerationGPU == "nvidia") vaapiVdpau)
(mkIf (config.hwAccelerationGPU == "nvidia") vulkan-validation-layers)
(mkIf (config.hwAccelerationGPU == "nvidia") vulkan-headers)
(mkIf (config.hwAccelerationGPU == "nvidia") vulkan-caps-viewer)
(mkIf (config.hwAccelerationGPU == "nvidia") vulkan-extension-layer)
(mkIf (config.hwAccelerationGPU == "nvidia") vulkan-tools)
]; ];
}; };

View file

@ -26,7 +26,10 @@ with lib;
./home-manager ./home-manager
sopsHmModule sopsHmModule
]; ];
home-manager.extraSpecialArgs.keymap = config.keymap; home-manager.extraSpecialArgs = {
keymap = config.keymap;
nvidiaGPU = (config.hwAccelerationGPU == "nvidia");
};
home-manager.users = builtins.mapAttrs home-manager.users = builtins.mapAttrs
(name: value: (name: value:
mkIf value.enableHomeManagerProfile ({ mkIf value.enableHomeManagerProfile ({

View file

@ -8,7 +8,10 @@ let
(builtins.attrNames config.machineUsers); (builtins.attrNames config.machineUsers);
in in
{ {
programs.sway.enable = usersHasSway; programs.sway = {
enable = usersHasSway;
};
xdg.portal = mkIf usersHasSway { xdg.portal = mkIf usersHasSway {
enable = true; enable = true;
wlr.enable = true; wlr.enable = true;

View file

@ -1,8 +1,9 @@
{ config, pkgs, lib, keymap, ... }: { config, pkgs, lib, keymap, nvidiaGPU, ... }:
with lib; with lib;
let let
isQwerty = keymap == "us"; isQwerty = keymap == "us";
gnomeSchema = "org.gnome.desktop.interface"; gnomeSchema = "org.gnome.desktop.interface";
rendererLine = if nvidiaGPU then "export WLR_RENDERER=vulkan" else "";
monitorModule = types.submodule { monitorModule = types.submodule {
options = { options = {
name = mkOption { name = mkOption {
@ -237,6 +238,7 @@ in
''; '';
extraSessionCommands = '' extraSessionCommands = ''
${rendererLine}
export WLR_NO_HARDWARE_CURSORS=1 export WLR_NO_HARDWARE_CURSORS=1
export XDG_CURRENT_DESKTOP=sway export XDG_CURRENT_DESKTOP=sway
export _JAVA_AWT_WM_NONREPARENTING=1 export _JAVA_AWT_WM_NONREPARENTING=1