Files
nixos/modules/drivers/nvidia.nix
luochen570 4488256039 modified: hosts/desktop/configuration.nix
modified:   hosts/desktop/hardware-configuration.nix
	modified:   modules/drivers/nvidia.nix
添加并整理了desktop的配置文件
2026-03-02 16:41:56 +08:00

46 lines
1.4 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{ config, ... }:
{
services.xserver.videoDrivers = [ "nvidia" ];
hardware.graphics.enable = true;
hardware.nvidia = {
modesetting.enable = true;
open = true;
nvidiaSettings = true;
powerManagement.enable = false;
powerManagement.finegrained = false
package = config.boot.kernelPackages.nvidiaPackages.latest;
};
# 备用方案(当前禁用):
# 如果后续要启用 AMD 核显 + NVIDIA 独显切换,请取消下面整段注释。
#
# 重要提醒:
# 1) 先确认两张显卡的 PCIe Bus ID再启用否则图形界面可能无法启动。
# 2) 获取命令lspci | grep -E "VGA|3D"
# 3) 示例输出常见为 "01:00.0"、"06:00.0"16 进制)。
# 4) Nix 配置常用写法PCI:<bus-dec>:<device-dec>:<function>
# 例如 01:00.0 -> PCI:1:0:006:00.0 -> PCI:6:0:0
#
# let
# amdgpuBusId = "PCI:6:0:0";
# nvidiaBusId = "PCI:1:0:0";
# in {
# services.xserver.videoDrivers = [ "amdgpu" "nvidia" ];
# hardware.nvidia.prime = {
# offload.enable = true;
# offload.enableOffloadCmd = true;
# amdgpuBusId = amdgpuBusId;
# nvidiaBusId = nvidiaBusId;
# };
# specialisation.nvidia-sync.configuration = {
# hardware.nvidia.prime = {
# offload.enable = lib.mkForce false;
# sync.enable = true;
# amdgpuBusId = amdgpuBusId;
# nvidiaBusId = nvidiaBusId;
# };
# };
# }
}