Add NVIDIA module
This commit is contained in:
parent
63c6be32cb
commit
80c85c28e9
2 changed files with 36 additions and 21 deletions
|
@ -3,6 +3,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
../../modules/hardware/nvidia.nix
|
||||||
|
|
||||||
../../modules/apps/virtualbox
|
../../modules/apps/virtualbox
|
||||||
../../modules/des/gnome
|
../../modules/des/gnome
|
||||||
|
@ -43,15 +44,11 @@
|
||||||
# };
|
# };
|
||||||
|
|
||||||
services.xserver = {
|
services.xserver = {
|
||||||
enable = true;
|
|
||||||
|
|
||||||
videoDrivers = [ "nvidia" ]; # Also for wayland compositors
|
|
||||||
|
|
||||||
# Configure keymap in X11
|
# Configure keymap in X11
|
||||||
layout = "us";
|
layout = "us";
|
||||||
xkbVariant = "";
|
xkbVariant = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Enable CUPS to print documents.
|
# Enable CUPS to print documents.
|
||||||
# services.printing.enable = true;
|
# services.printing.enable = true;
|
||||||
|
|
||||||
|
@ -78,21 +75,6 @@
|
||||||
# Enable touchpad support (enabled default in most desktopManager).
|
# Enable touchpad support (enabled default in most desktopManager).
|
||||||
services.xserver.libinput.enable = true;
|
services.xserver.libinput.enable = true;
|
||||||
|
|
||||||
# NVIDIA drivers
|
|
||||||
hardware = {
|
|
||||||
opengl.enable = true;
|
|
||||||
nvidia = {
|
|
||||||
open = true;
|
|
||||||
# package = config.boot.kernelPackages.nvidiaPackages.stable;
|
|
||||||
modesetting.enable = true;
|
|
||||||
# prime = {
|
|
||||||
# offload.enable = true;
|
|
||||||
# intelBusId = "PCI::00:02:0";
|
|
||||||
# nvidiaBusId = "PCI:01:00:0";
|
|
||||||
# };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Allow unfree packages
|
# Allow unfree packages
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
|
33
nixos/modules/hardware/nvidia.nix
Normal file
33
nixos/modules/hardware/nvidia.nix
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{ inputs, lib, 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
|
||||||
|
{
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
|
|
||||||
|
hardware = {
|
||||||
|
opengl.enable = true;
|
||||||
|
nvidia = {
|
||||||
|
open = true;
|
||||||
|
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||||
|
modesetting.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Offloading
|
||||||
|
# environment.systemPackages = [ nvidia-offload ];
|
||||||
|
# hardware.nvidia.prime = {
|
||||||
|
# offload.enable = true;
|
||||||
|
# intelBusId = "PCI::00:02:0";
|
||||||
|
# nvidiaBusId = "PCI:01:00:0";
|
||||||
|
# };
|
||||||
|
}
|
Loading…
Reference in a new issue