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

View file

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