From 96acd705cb8c65eecaf5aabc8bdb7f713c13247a Mon Sep 17 00:00:00 2001 From: Andreas Schaafsma Date: Wed, 13 Nov 2024 05:22:21 +0100 Subject: [PATCH] this sorta worked --- .../drivebystation-nix/default.nix | 44 ------------ .../drivebystation-nix/nvidia.nix | 19 ++++- .../x86_64-linux/drivebystation-nix/steam.nix | 72 +++++++++++++++++++ 3 files changed, 88 insertions(+), 47 deletions(-) create mode 100644 systems/x86_64-linux/drivebystation-nix/steam.nix diff --git a/systems/x86_64-linux/drivebystation-nix/default.nix b/systems/x86_64-linux/drivebystation-nix/default.nix index 5530e3c..bf906b2 100644 --- a/systems/x86_64-linux/drivebystation-nix/default.nix +++ b/systems/x86_64-linux/drivebystation-nix/default.nix @@ -55,50 +55,6 @@ in ]; }; # lib.my-namespace.home.stream-tools.enable = true; - programs.gamescope.enable = true; - programs.steam = { - enable = true; - remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play - dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server - localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers - - gamescopeSession = { - enable = true; - env = { - # WLR_RENDERER = "vulkan"; - # DXVK_HDR = "1"; - ENABLE_GAMESCOPE_WSI = "1"; - WINE_FULLSCREEN_FSR = "1"; - # Games allegedly prefer X11 - SDL_VIDEODRIVER = "x11"; - }; - args = [ - "--xwayland-count 2" - "--expose-wayland" - - "-e" # Enable steam integration - "--steam" - - # "--adaptive-sync" - # "--hdr-enabled" - # "--hdr-itm-enable" - - # External monitor - "--prefer-output DP-3" - "--output-width 1920" - "--output-height 1080" - "-r 172" - - # Laptop display - # "--prefer-output eDP-1" - # "--output-width 2560" - # "--output-height 1600" - # "-r 120" - - "--prefer-vk-device 10de:1b81" # lspci -nn | grep VGA - ]; - }; - }; # Open ports in the firewall. networking.firewall.allowedTCPPorts = [ diff --git a/systems/x86_64-linux/drivebystation-nix/nvidia.nix b/systems/x86_64-linux/drivebystation-nix/nvidia.nix index a966370..077c371 100644 --- a/systems/x86_64-linux/drivebystation-nix/nvidia.nix +++ b/systems/x86_64-linux/drivebystation-nix/nvidia.nix @@ -4,10 +4,13 @@ # Enable OpenGL hardware.graphics = { enable = true; + extraPackages = with pkgs; [ nvidia-vaapi-driver ]; }; # Load nvidia driver for Xorg and Wayland - #boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ]; + # boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ]; + boot.extraModulePackages = [ config.boot.kernelPackages.nvidia_x11_vulkan_beta ]; + boot.kernelParams = [ "nvidia-drm.fbdev=1" "nvidia-drm.modeset=1" @@ -18,7 +21,15 @@ "nouveau" ]; services.xserver.videoDrivers = [ "nvidia" ]; - boot.initrd.kernelModules = [ "nvidia" "nvidia-drm" ]; + boot.initrd.kernelModules = [ + "nvidia" + "nvidia-drm" + "nvidia-modeset" + "nvidia-uvm" + "nvidia_modeset" + "nvidia_uvm" + "i2c-nvidia_gpu" + ]; #boot.initrd.kernelModules = [ "nvidia" ]; @@ -50,7 +61,9 @@ nvidiaSettings = true; # Optionally, you may need to select the appropriate driver version for your specific GPU. - package = config.boot.kernelPackages.nvidiaPackages.beta; + # package = config.boot.kernelPackages.nvidiaPackages.beta; + package = config.boot.kernelPackages.nvidiaPackages.vulkan_beta; + }; # users.users.andreas = { # extraGroups = [ "video" "render" ]; diff --git a/systems/x86_64-linux/drivebystation-nix/steam.nix b/systems/x86_64-linux/drivebystation-nix/steam.nix new file mode 100644 index 0000000..7a38504 --- /dev/null +++ b/systems/x86_64-linux/drivebystation-nix/steam.nix @@ -0,0 +1,72 @@ +{ + # Snowfall Lib provides a customized `lib` instance with access to your flake's library + # as well as the libraries available from your flake's inputs. + lib, + # An instance of `pkgs` with your overlays and packages applied is also available. + pkgs, + # You also have access to your flake's inputs. + inputs, + # Additional metadata is provided by Snowfall Lib. + # The namespace used for your flake, defaulting to "internal" if not set. + namespace, + # The system architecture for this host (eg. `x86_64-linux`). + system, + # The Snowfall Lib target for this system (eg. `x86_64-iso`). + target, + # A normalized name for the system target (eg. `iso`). + format, + # A boolean to determine whether this system is a virtual target using nixos-generators. + virtual, + # An attribute map of your defined hosts. + systems, + # All other arguments come from the system system. + config +, ... +}:{ + config = { + programs.gamescope.enable = true; + programs.steam = { + enable = true; + remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play + dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server + localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers + + gamescopeSession = { + enable = true; + env = { + WLR_RENDERER = "vulkan"; + DXVK_HDR = "1"; + ENABLE_GAMESCOPE_WSI = "1"; + WINE_FULLSCREEN_FSR = "1"; + # Games allegedly prefer X11 + SDL_VIDEODRIVER = "x11"; + }; + args = [ + "--xwayland-count 1" + "--expose-wayland" + + "-e" # Enable steam integration + "--steam" + + # "--adaptive-sync" + # "--hdr-enabled" + # "--hdr-itm-enable" + + # External monitor + "--prefer-output DP-3" + "--output-width 1920" + "--output-height 1080" + "-r 172" + + # Laptop display + # "--prefer-output eDP-1" + # "--output-width 2560" + # "--output-height 1600" + # "-r 120" + + "--prefer-vk-device 10de:1b81" # lspci -nn | grep VGA + ]; + }; + }; + }; +} \ No newline at end of file