diff --git a/nixos/msi/boot.nix b/nixos/msi/boot.nix index cd2c0a6..17cf3d7 100644 --- a/nixos/msi/boot.nix +++ b/nixos/msi/boot.nix @@ -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; diff --git a/nixos/msi/configuration.nix b/nixos/msi/configuration.nix index d93a2ba..b450722 100644 --- a/nixos/msi/configuration.nix +++ b/nixos/msi/configuration.nix @@ -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 = [ ... ]; diff --git a/nixos/msi/gaming.nix b/nixos/msi/gaming.nix new file mode 100644 index 0000000..c78fe39 --- /dev/null +++ b/nixos/msi/gaming.nix @@ -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"; + }; +} diff --git a/nixos/msi/nvidia.nix b/nixos/msi/nvidia.nix index 87d896f..050fe9c 100644 --- a/nixos/msi/nvidia.nix +++ b/nixos/msi/nvidia.nix @@ -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"; + }; + }; }