mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-05-19 14:17:26 +02:00
feat: idols-ai - use intel intel iGPU by default, choose Nvidia dGPU manullay - via prime (#258)
* feat: idols-ai - use intel intel iGPU by default, choose Nvidia dGPU manullay - via prime
* fix: niri - update output names for new motherboard
* fix: niri - DP-1 with prime offload mode - supports only 120HZ
* flake.lock: Update
Flake lock file updates:
• Updated input 'nixpkgs-master':
'github:nixos/nixpkgs/3879e47ce293fb2932d656aa56551a8e80718533?narHash=sha256-siN4x7y/S0FOdjPC1W0Z/vrX4Rlu%2BVClkEGngmSd0vM%3D' (2026-03-24)
→ 'github:nixos/nixpkgs/03de9fe87cb2dcec8da9dbaa3ad1c71ea7fef223?narHash=sha256-B7GmxbRADkklyXzV1ahgY4QhCpbQ3crzPCCs2hf6bPM%3D' (2026-04-26)
* flake.lock: Update
Flake lock file updates:
• Updated input 'nixpkgs-stable':
'github:nixos/nixpkgs/e9f278faa1d0c2fc835bd331d4666b59b505a410?narHash=sha256-Jms57zzlFf64ayKzzBWSE2SGvJmK%2BNGt8Gli71d9kmY%3D' (2026-03-14)
→ 'github:nixos/nixpkgs/a4bf06618f0b5ee50f14ed8f0da77d34ecc19160?narHash=sha256-AIiMJiqvGrN4HyLEbKAoCSRRYn0rnlW5VbKNIMIYqm4%3D' (2026-04-25)
This commit is contained in:
Generated
+6
-6
@@ -880,11 +880,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-master": {
|
"nixpkgs-master": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774325747,
|
"lastModified": 1777221542,
|
||||||
"narHash": "sha256-siN4x7y/S0FOdjPC1W0Z/vrX4Rlu+VClkEGngmSd0vM=",
|
"narHash": "sha256-B7GmxbRADkklyXzV1ahgY4QhCpbQ3crzPCCs2hf6bPM=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "3879e47ce293fb2932d656aa56551a8e80718533",
|
"rev": "03de9fe87cb2dcec8da9dbaa3ad1c71ea7fef223",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -912,11 +912,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-stable": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1773524153,
|
"lastModified": 1777077449,
|
||||||
"narHash": "sha256-Jms57zzlFf64ayKzzBWSE2SGvJmK+NGt8Gli71d9kmY=",
|
"narHash": "sha256-AIiMJiqvGrN4HyLEbKAoCSRRYn0rnlW5VbKNIMIYqm4=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "e9f278faa1d0c2fc835bd331d4666b59b505a410",
|
"rev": "a4bf06618f0b5ee50f14ed8f0da77d34ecc19160",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -27,11 +27,14 @@ in
|
|||||||
|
|
||||||
# Include the results of the hardware scan.
|
# Include the results of the hardware scan.
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
./nvidia.nix
|
./hardware-intel.nix
|
||||||
./ai
|
./hardware-nvidia.nix
|
||||||
|
|
||||||
./preservation.nix
|
./preservation.nix
|
||||||
./secureboot.nix
|
./secureboot.nix
|
||||||
|
|
||||||
|
# others
|
||||||
|
./ai
|
||||||
];
|
];
|
||||||
|
|
||||||
# Zram consumes physical memory for compression, which can cause a deadlock and system hang if the model size approaches the physical memory limit.
|
# Zram consumes physical memory for compression, which can cause a deadlock and system hang if the model size approaches the physical memory limit.
|
||||||
|
|||||||
@@ -51,10 +51,6 @@
|
|||||||
"usb_storage"
|
"usb_storage"
|
||||||
"sd_mod"
|
"sd_mod"
|
||||||
];
|
];
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelModules = [ "kvm-intel" ]; # kvm virtualization support
|
|
||||||
boot.extraModprobeConfig = "options kvm_intel nested=1"; # for intel cpu
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
# clear /tmp on boot to get a stateless /tmp directory.
|
# clear /tmp on boot to get a stateless /tmp directory.
|
||||||
boot.tmp.cleanOnBoot = true;
|
boot.tmp.cleanOnBoot = true;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
modulesPath,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
(modulesPath + "/hardware/cpu/intel-npu.nix")
|
||||||
|
];
|
||||||
|
|
||||||
|
# Intel NPU support
|
||||||
|
hardware.cpu.intel.npu.enable = true;
|
||||||
|
|
||||||
|
# kvm virtualization support
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
|
boot.extraModprobeConfig = "options kvm_intel nested=1";
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
# Intel Graphics
|
||||||
|
# https://wiki.nixos.org/wiki/Intel_Graphics
|
||||||
|
|
||||||
|
services.xserver.videoDrivers = [ "modesetting" ];
|
||||||
|
|
||||||
|
hardware.graphics = {
|
||||||
|
enable = true;
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
# Required for modern Intel GPUs (Xe iGPU and ARC)
|
||||||
|
intel-media-driver # VA-API (iHD) userspace
|
||||||
|
vpl-gpu-rt # oneVPL (QSV) runtime
|
||||||
|
|
||||||
|
# Optional (compute / tooling):
|
||||||
|
intel-compute-runtime # OpenCL (NEO) + Level Zero for Arc/Xe
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.sessionVariables = {
|
||||||
|
LIBVA_DRIVER_NAME = "iHD"; # Prefer the modern iHD backend
|
||||||
|
};
|
||||||
|
|
||||||
|
# May help if FFmpeg/VAAPI/QSV init fails (esp. on Arc with i915):
|
||||||
|
hardware.enableRedistributableFirmware = true;
|
||||||
|
boot.kernelParams = [ "i915.enable_guc=3" ];
|
||||||
|
|
||||||
|
# May help services that have trouble accessing /dev/dri (e.g., jellyfin/plex):
|
||||||
|
# users.users.<service>.extraGroups = [ "video" "render" ];
|
||||||
|
}
|
||||||
@@ -11,12 +11,22 @@
|
|||||||
# https://wiki.hyprland.org/Nvidia/
|
# https://wiki.hyprland.org/Nvidia/
|
||||||
# ===============================================================================================
|
# ===============================================================================================
|
||||||
|
|
||||||
|
# Hybrid graphics with PRIME[integrated GPU (iGPU) + dedicated GPU (dGPU)]
|
||||||
|
hardware.nvidia.prime = {
|
||||||
|
# puts dGPU(Nvidia) to sleep and lets the iGPU handle all tasks by default.
|
||||||
|
offload.enable = true;
|
||||||
|
|
||||||
|
intelBusId = "PCI:0@0:2:0";
|
||||||
|
nvidiaBusId = "PCI:2@0:0:0";
|
||||||
|
};
|
||||||
|
|
||||||
boot.kernelParams = [
|
boot.kernelParams = [
|
||||||
# Since NVIDIA does not load kernel mode setting by default,
|
# Since NVIDIA does not load kernel mode setting by default,
|
||||||
# enabling it is required to make Wayland compositors function properly.
|
# enabling it is required to make Wayland compositors function properly.
|
||||||
"nvidia-drm.fbdev=1"
|
"nvidia-drm.fbdev=1"
|
||||||
];
|
];
|
||||||
services.xserver.videoDrivers = [ "nvidia" ]; # will install nvidia-vaapi-driver by default
|
services.xserver.videoDrivers = [ "nvidia" ]; # will install nvidia-vaapi-driver by default
|
||||||
|
|
||||||
hardware.nvidia = {
|
hardware.nvidia = {
|
||||||
# Open-source kernel modules are preferred over and planned to steadily replace proprietary modules
|
# Open-source kernel modules are preferred over and planned to steadily replace proprietary modules
|
||||||
open = true;
|
open = true;
|
||||||
@@ -43,14 +53,6 @@
|
|||||||
enable32Bit = true;
|
enable32Bit = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
(_: super: {
|
|
||||||
# ffmpeg-full = super.ffmpeg-full.override {
|
|
||||||
# withNvcodec = true;
|
|
||||||
# };
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
services.sunshine.settings = {
|
services.sunshine.settings = {
|
||||||
max_bitrate = 20000; # in Kbps
|
max_bitrate = 20000; # in Kbps
|
||||||
# NVIDIA NVENC Encoder
|
# NVIDIA NVENC Encoder
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// running `niri msg outputs` to find outputs
|
// running `niri msg outputs` to find outputs
|
||||||
output "DP-2" {
|
output "DP-1" {
|
||||||
// Uncomment this line to disable this output.
|
// Uncomment this line to disable this output.
|
||||||
// off
|
// off
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ output "DP-2" {
|
|||||||
// for the resolution.
|
// for the resolution.
|
||||||
// If the mode is omitted altogether or is invalid, niri will pick one automatically.
|
// If the mode is omitted altogether or is invalid, niri will pick one automatically.
|
||||||
// Run `niri msg outputs` while inside a niri instance to list all outputs and their modes.
|
// Run `niri msg outputs` while inside a niri instance to list all outputs and their modes.
|
||||||
mode "3840x2160@144"
|
mode "3840x2160@120"
|
||||||
|
|
||||||
// Position of the output in the global coordinate space.
|
// Position of the output in the global coordinate space.
|
||||||
// This affects directional monitor actions like "focus-monitor-left", and cursor movement.
|
// This affects directional monitor actions like "focus-monitor-left", and cursor movement.
|
||||||
@@ -30,7 +30,7 @@ output "DP-2" {
|
|||||||
position x=0 y=0
|
position x=0 y=0
|
||||||
}
|
}
|
||||||
|
|
||||||
output "HDMI-A-1" {
|
output "HDMI-A-2" {
|
||||||
scale 1.5
|
scale 1.5
|
||||||
transform "normal"
|
transform "normal"
|
||||||
mode "3840x2160@60"
|
mode "3840x2160@60"
|
||||||
@@ -38,14 +38,14 @@ output "HDMI-A-1" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ============= Named Workspaces =============
|
// ============= Named Workspaces =============
|
||||||
workspace "2browser" { open-on-output "DP-2"; }
|
workspace "2browser" { open-on-output "DP-1"; }
|
||||||
workspace "4gaming" { open-on-output "DP-2"; }
|
workspace "4gaming" { open-on-output "DP-1"; }
|
||||||
workspace "5music" { open-on-output "DP-2"; }
|
workspace "5music" { open-on-output "DP-1"; }
|
||||||
|
|
||||||
workspace "1terminal" { open-on-output "HDMI-A-1"; }
|
workspace "1terminal" { open-on-output "HDMI-A-2"; }
|
||||||
workspace "3chat" { open-on-output "HDMI-A-1"; }
|
workspace "3chat" { open-on-output "HDMI-A-2"; }
|
||||||
workspace "6file" { open-on-output "HDMI-A-1"; }
|
workspace "6file" { open-on-output "HDMI-A-2"; }
|
||||||
workspace "7" { open-on-output "HDMI-A-1"; }
|
workspace "7" { open-on-output "HDMI-A-2"; }
|
||||||
workspace "8" { open-on-output "HDMI-A-1"; }
|
workspace "8" { open-on-output "HDMI-A-2"; }
|
||||||
workspace "9" { open-on-output "HDMI-A-1"; }
|
workspace "9" { open-on-output "HDMI-A-2"; }
|
||||||
workspace "0other" { open-on-output "HDMI-A-1"; }
|
workspace "0other" { open-on-output "HDMI-A-2"; }
|
||||||
|
|||||||
Reference in New Issue
Block a user