Added nvidia drivers and gaming profile
This commit is contained in:
@@ -85,3 +85,9 @@ nixos-generate-config --dir <<host directory>> --no-filesystems
|
|||||||
#+BEGIN_SRC bash
|
#+BEGIN_SRC bash
|
||||||
sudo nixos-install --impure --root /mnt --flake .#reykjavik
|
sudo nixos-install --impure --root /mnt --flake .#reykjavik
|
||||||
#+END_SRC
|
#+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
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
# - Reykjavik ----------------------------
|
# - Reykjavik ----------------------------
|
||||||
reykjavik = lib.nixosSystem {
|
reykjavik = lib.nixosSystem {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
inherit pkgs;
|
||||||
modules = [
|
modules = [
|
||||||
|
|
||||||
./system/modules
|
./system/modules
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
samfelag = {
|
samfelag = {
|
||||||
profiles = {
|
profiles = {
|
||||||
desktop.enable = true;
|
desktop.enable = true;
|
||||||
|
gaming.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,5 +4,6 @@
|
|||||||
imports = [
|
imports = [
|
||||||
./common.nix
|
./common.nix
|
||||||
./desktop.nix
|
./desktop.nix
|
||||||
|
./gaming.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
24
home/profiles/gaming.nix
Normal file
24
home/profiles/gaming.nix
Normal 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
|
||||||
|
];
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./hardware.nix
|
./hardware.nix
|
||||||
|
./nvidia.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# - Basic --------------------------------------
|
# - Basic --------------------------------------
|
||||||
@@ -19,9 +20,12 @@
|
|||||||
|
|
||||||
# - Services -----------------------------------
|
# - Services -----------------------------------
|
||||||
|
|
||||||
samfelag.profiles.desktop = {
|
samfelag.profiles = {
|
||||||
enable = true;
|
desktop = {
|
||||||
laptop = true;
|
enable = true;
|
||||||
|
laptop = true;
|
||||||
|
};
|
||||||
|
gaming.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
system.stateVersion = "22.05";
|
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 = [
|
imports = [
|
||||||
./common.nix
|
./common.nix
|
||||||
./desktop.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