nixos: gaming config

This commit is contained in:
Maciej Jur 2024-06-21 18:54:38 +02:00
parent fe0166970e
commit cf1813f3c0
Signed by: kamov
GPG key ID: 191CBFF5F72ECAFD
4 changed files with 76 additions and 46 deletions

View file

@ -3,6 +3,12 @@
boot = {
kernelPackages = pkgs.linuxPackages_latest;
# Use the systemd-boot EFI boot loader.
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
initrd = {
verbose = false;
systemd.enable = true;

View file

@ -35,12 +35,9 @@ in
./nvidia.nix
./boot.nix
./home.nix
./gaming.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Nix package installer settings
nix = {
settings = {
@ -128,7 +125,6 @@ in
enableSSHSupport = true;
};
};
steam.enable = true;
fish.enable = true;
git = {
enable = true;
@ -148,6 +144,12 @@ in
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Enable fstrim for SSD
services.fstrim.enable = true;
# Hard disk protection if the laptop falls
services.hdapsd.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];

22
nixos/msi/gaming.nix Normal file
View file

@ -0,0 +1,22 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
mangohud
protonup
lutris
bottles
];
programs = {
steam = {
enable = true;
gamescopeSession.enable = true;
};
gamemode.enable = true;
};
environment.sessionVariables = {
# Tell protonup where to install patched proton GE
STEAM_EXTRA_COMPAT_TOOLS_PATHS = "/home/kamov/.steam/root/compatibilitytools.d";
};
}

View file

@ -1,54 +1,54 @@
{ pkgs, config, libs, ... }:
{
# Enable unfree packages
nixpkgs.config.allowUnfree = true;
# Enable unfree packages
nixpkgs.config.allowUnfree = true;
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = [ "nvidia" ];
# Load nvidia driver for Xorg and Wayland
services.xserver.videoDrivers = [ "nvidia" ];
# Disable nouveau driver
boot.blacklistedKernelModules = [ "nouveau" ];
# Disable nouveau driver
boot.blacklistedKernelModules = [ "nouveau" ];
hardware.nvidia = {
# Modesetting is required.
modesetting.enable = true;
hardware.nvidia = {
# Modesetting is required.
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
powerManagement.enable = false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = false;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
powerManagement.enable = false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
# Currently alpha-quality/buggy, so false is currently the recommended setting.
open = false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
# Currently alpha-quality/buggy, so false is currently the recommended setting.
open = false;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.stable;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.stable;
prime = {
# Without this option set to true SDDM didn't want to start.
sync.enable = true;
# Make sure to use the correct Bus ID values for your system!
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
prime = {
# Without this option set to true SDDM didn't want to start.
sync.enable = true;
# Make sure to use the correct Bus ID values for your system!
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
}