Files
nixos/modules/drivers/nvidia.nix
luochen570 c92c904e76 chore: clean up and optimize nixos configuration
- fix: nvidia.nix missing semicolon (build error)
- remove: ranger, vim from core/pkg.nix (yazi + neovim covers)
- remove: htop duplicate in home/pkg.nix (keep in system)
- replace: neofetch with fastfetch in home/pkg.nix
- remove: nixd LSP, keep nil only in nvchad.nix
- remove: empty server/pkg.nix and no-op server/firewall.nix
- remove: redundant services.pulseaudio.enable = false default
- add: comprehensive README.md documenting architecture
2026-05-24 10:36:23 +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;
# };
# };
# }
}