Added nvidia drivers and gaming profile

This commit is contained in:
marc
2022-11-04 19:32:53 +01:00
parent f4d6589bd1
commit 0f4b895d38
9 changed files with 89 additions and 3 deletions

View File

@@ -85,3 +85,9 @@ nixos-generate-config --dir <<host directory>> --no-filesystems
#+BEGIN_SRC bash
sudo nixos-install --impure --root /mnt --flake .#reykjavik
#+END_SRC
1. Set up the user
You'll set the root password during the installation. You can then reboot and use the installed OS. First thing you'll have to do is log in as root and set the password for your user:
#+BEGIN_SRC bash
passwd marc
#+END_SRC

View File

@@ -51,6 +51,7 @@
# - Reykjavik ----------------------------
reykjavik = lib.nixosSystem {
inherit system;
inherit pkgs;
modules = [
./system/modules

View File

@@ -6,6 +6,7 @@
samfelag = {
profiles = {
desktop.enable = true;
gaming.enable = true;
};
};
}

View File

@@ -4,5 +4,6 @@
imports = [
./common.nix
./desktop.nix
./gaming.nix
];
}

24
home/profiles/gaming.nix Normal file
View File

@@ -0,0 +1,24 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.samfelag.profiles.gaming;
in
{
options.samfelag.profiles.gaming = {
enable = mkEnableOption "gaming profile";
};
config = mkIf cfg.enable {
# - Dependencies -----------------------------
samfelag.modules = {
};
home.packages = with pkgs; [
lutris
];
};
}

View File

@@ -3,6 +3,7 @@
{
imports = [
./hardware.nix
./nvidia.nix
];
# - Basic --------------------------------------
@@ -19,10 +20,13 @@
# - Services -----------------------------------
samfelag.profiles.desktop = {
samfelag.profiles = {
desktop = {
enable = true;
laptop = true;
};
gaming.enable = true;
};
system.stateVersion = "22.05";

View 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";
};
}

View File

@@ -4,5 +4,6 @@
imports = [
./common.nix
./desktop.nix
./gaming.nix
];
}

View 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
};
};
}