Added nvidia drivers and gaming profile
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
{
|
||||
imports = [
|
||||
./hardware.nix
|
||||
./nvidia.nix
|
||||
];
|
||||
|
||||
# - Basic --------------------------------------
|
||||
@@ -19,9 +20,12 @@
|
||||
|
||||
# - Services -----------------------------------
|
||||
|
||||
samfelag.profiles.desktop = {
|
||||
enable = true;
|
||||
laptop = true;
|
||||
samfelag.profiles = {
|
||||
desktop = {
|
||||
enable = true;
|
||||
laptop = true;
|
||||
};
|
||||
gaming.enable = true;
|
||||
};
|
||||
|
||||
system.stateVersion = "22.05";
|
||||
|
||||
29
system/hosts/reykjavik/nvidia.nix
Normal file
29
system/hosts/reykjavik/nvidia.nix
Normal file
@@ -0,0 +1,29 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
|
||||
export __NV_PRIME_RENDER_OFFLOAD=1
|
||||
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
|
||||
export __GLX_VENDOR_LIBRARY_NAME=nvidia
|
||||
export __VK_LAYER_NV_optimus=NVIDIA_only
|
||||
exec "$@"
|
||||
'';
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [ nvidia-offload ];
|
||||
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
|
||||
hardware.opengl.enable = true;
|
||||
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
|
||||
hardware.nvidia.prime = {
|
||||
offload.enable = true;
|
||||
|
||||
# Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA
|
||||
intelBusId = "PCI:0:2:0";
|
||||
|
||||
# Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
|
||||
nvidiaBusId = "PCI:1:0:0";
|
||||
};
|
||||
}
|
||||
@@ -4,5 +4,6 @@
|
||||
imports = [
|
||||
./common.nix
|
||||
./desktop.nix
|
||||
./gaming.nix
|
||||
];
|
||||
}
|
||||
|
||||
19
system/profiles/gaming.nix
Normal file
19
system/profiles/gaming.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.profiles.gaming;
|
||||
in
|
||||
{
|
||||
options.samfelag.profiles.gaming = {
|
||||
|
||||
enable = lib.mkEnableOption "gaming profile";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
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
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user