From 487a12e5b151007988e7048797d8ea691ccbdec4 Mon Sep 17 00:00:00 2001 From: Victor Mignot Date: Thu, 28 Nov 2024 18:30:52 +0100 Subject: [PATCH] (re)switch to Nvidia drivers --- modules/common/hardware.nix | 7 +++ .../home-manager/desktop/sway/default.nix | 47 +++++-------------- modules/workstation/home-manager/fish.nix | 4 +- 3 files changed, 21 insertions(+), 37 deletions(-) diff --git a/modules/common/hardware.nix b/modules/common/hardware.nix index c47156f..f0a6c0d 100644 --- a/modules/common/hardware.nix +++ b/modules/common/hardware.nix @@ -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; + }; + }; } diff --git a/modules/workstation/home-manager/desktop/sway/default.nix b/modules/workstation/home-manager/desktop/sway/default.nix index 39fa29c..a6a309a 100644 --- a/modules/workstation/home-manager/desktop/sway/default.nix +++ b/modules/workstation/home-manager/desktop/sway/default.nix @@ -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 diff --git a/modules/workstation/home-manager/fish.nix b/modules/workstation/home-manager/fish.nix index 62822c4..baf7883 100644 --- a/modules/workstation/home-manager/fish.nix +++ b/modules/workstation/home-manager/fish.nix @@ -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