initial commit
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
{...}: {
|
||||
# AMD CPU: microcode updates (applied via initrd at boot).
|
||||
flake.nixosModules.cpuAmd = {...}: {
|
||||
hardware.cpu.amd.updateMicrocode = true;
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{...}: {
|
||||
# Intel CPU: microcode updates (applied via initrd at boot).
|
||||
flake.nixosModules.cpuIntel = {...}: {
|
||||
hardware.cpu.intel.updateMicrocode = true;
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{...}: {
|
||||
# AMD GPU (mesa + RADV/ROCm).
|
||||
flake.nixosModules.gpuAmd = {pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
mesa
|
||||
vulkan-tools
|
||||
rocmPackages.rocm-smi
|
||||
rocmPackages.rocminfo
|
||||
];
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
extraPackages = with pkgs; [
|
||||
libva-vdpau-driver
|
||||
libvdpau-va-gl
|
||||
rocmPackages.clr.icd
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{...}: {
|
||||
# Intel integrated GPU (mesa + VA-API hardware video acceleration).
|
||||
flake.nixosModules.gpuIntel = {pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
mesa
|
||||
vulkan-tools
|
||||
];
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
extraPackages = with pkgs; [
|
||||
intel-media-driver # modern iHD driver (Broadwell+)
|
||||
intel-vaapi-driver # legacy i965 driver
|
||||
libva-vdpau-driver
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
{self, ...}: {
|
||||
# Hybrid Intel + NVIDIA (PRIME) for laptops like the T480 (Intel UHD 620 +
|
||||
# NVIDIA MX150). Uses "offload" mode: the dGPU stays powered down by default
|
||||
# (minimal extra battery drain) and is only used for apps launched with
|
||||
# `nvidia-offload <cmd>`. It also pulls in the Intel GPU stack (gpuIntel).
|
||||
#
|
||||
# Bus IDs below are specific to the T480 (from `lspci`):
|
||||
# Intel 00:02.0 -> PCI:0:2:0
|
||||
# NVIDIA 01:00.0 -> PCI:1:0:0
|
||||
# Adjust for other machines.
|
||||
flake.nixosModules.gpuNvidiaPrime = {
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
imports = [self.nixosModules.gpuIntel];
|
||||
|
||||
services.xserver.videoDrivers = ["nvidia"];
|
||||
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true;
|
||||
# MX150 is Pascal (pre-Turing); the proprietary modules are the safe choice.
|
||||
open = false;
|
||||
nvidiaSettings = true;
|
||||
powerManagement.enable = true;
|
||||
|
||||
prime = {
|
||||
# Offload keeps the NVIDIA GPU asleep until explicitly used. This gives
|
||||
# the `nvidia-offload` helper wrapper. Swap to sync mode if you want the
|
||||
# dGPU always driving the display (higher power draw).
|
||||
offload = {
|
||||
enable = true;
|
||||
enableOffloadCmd = true; # provides `nvidia-offload` wrapper
|
||||
};
|
||||
|
||||
intelBusId = "PCI:0:2:0";
|
||||
nvidiaBusId = "PCI:1:0:0";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{...}: {
|
||||
# Dedicated NVIDIA GPU (single discrete card, no hybrid/PRIME).
|
||||
# For Intel+NVIDIA laptops (e.g. the T480), use gpuNvidiaPrime instead.
|
||||
flake.nixosModules.gpuNvidia = {
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
services.xserver.videoDrivers = ["nvidia"];
|
||||
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
};
|
||||
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true;
|
||||
# Proprietary kernel modules. Set to true only for Turing+ (RTX 20xx and
|
||||
# newer) where the open modules are well supported.
|
||||
open = false;
|
||||
nvidiaSettings = true;
|
||||
# Fixes suspend/resume corruption on many setups.
|
||||
powerManagement.enable = true;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
vulkan-tools
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user