(re)switch to Nvidia drivers

This commit is contained in:
Victor Mignot 2024-11-28 18:30:52 +01:00
parent c38acd0f0f
commit 487a12e5b1
No known key found for this signature in database
GPG key ID: 5E7F2CE1BEAFED3D
3 changed files with 21 additions and 37 deletions

View file

@ -35,6 +35,7 @@ with lib;
config = { config = {
boot.kernelParams = mkIf (gpu == "intel") [ "i915.enable_guc=2" ]; boot.kernelParams = mkIf (gpu == "intel") [ "i915.enable_guc=2" ];
services.xserver.videoDrivers = mkIf (gpu == "nvidia") [ "nvidia" ];
# Small hack as this option path changes between 24.05 and unstable # Small hack as this option path changes between 24.05 and unstable
hardware.${hwAccelerationOptionPath} = { hardware.${hwAccelerationOptionPath} = {
@ -48,5 +49,11 @@ with lib;
]; ];
}; };
hardware.nvidia = mkIf (gpu == "nvidia") {
open = true;
package = config.boot.kernelPackages.nvidiaPackages.beta;
};
}; };
} }

View file

@ -3,20 +3,11 @@
pkgs, pkgs,
lib, lib,
keymap, keymap,
isNvidiaGpu,
... ...
}: }:
with lib; with lib;
let let
isQwerty = keymap == "us"; isQwerty = keymap == "us";
wlrRendererLine =
if isNvidiaGpu then
''
export MESA_LOADER_DRIVER_OVERRIDE=zink
export NOUVEAU_USE_ZINK=1
''
else
"";
monitorModule = types.submodule { monitorModule = types.submodule {
options = { options = {
name = mkOption { type = types.str; }; name = mkOption { type = types.str; };
@ -25,31 +16,17 @@ let
defaultWorkspace = mkOption { type = types.int; }; defaultWorkspace = mkOption { type = types.int; };
}; };
}; };
desktopPackages = desktopPackages = with pkgs; [
with pkgs; grim
[ slurp
grim wl-clipboard
slurp clipman
wl-clipboard wf-recorder
clipman font-awesome
wf-recorder jetbrains-mono
font-awesome xdg-utils
jetbrains-mono libnotify
xdg-utils ];
libnotify
]
++ (
if isNvidiaGpu then
[
vulkan-validation-layers
vulkan-headers
vulkan-caps-viewer
vulkan-extension-layer
vulkan-tools
]
else
[ ]
);
in in
{ {
imports = [ imports = [
@ -100,7 +77,6 @@ in
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
systemd.enable = false;
package = null; package = null;
checkConfig = false; checkConfig = false;
@ -305,7 +281,6 @@ in
xwayland = true; xwayland = true;
extraSessionCommands = '' extraSessionCommands = ''
${wlrRendererLine}
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

View file

@ -2,14 +2,16 @@
pkgs, pkgs,
config, config,
lib, lib,
isNvidiaGpu,
... ...
}: }:
let let
swayFlags = if isNvidiaGpu then "--unsupported-gpu" else "";
swayLaunchScript = swayLaunchScript =
if config.my.desktop.sway.enable then if config.my.desktop.sway.enable then
'' ''
if [ -z $DISPLAY ] && [ "$(tty)" = /dev/tty1 ] if [ -z $DISPLAY ] && [ "$(tty)" = /dev/tty1 ]
exec dbus-run-session sway exec dbus-run-session sway ${swayFlags}
end end
'' ''
else else