I’ve been tinkering a bit these days and managed to untangle some things and tangle some others.
I’m facing something similar to this user:
Firstly, I’ve imported this nixos-hardware config at my configuration.nix.
Looks like this:
{
imports = [
../../../common/cpu/amd
../../../common/cpu/amd/pstate.nix
../../../common/gpu/nvidia
../../../common/gpu/nvidia/prime.nix
../../../common/gpu/nvidia/ampere
../../../common/pc/laptop
../../../common/pc/ssd
../../battery.nix
];
#these ids are correct to my machine
hardware.nvidia.prime = {
amdgpuBusId = “PCI:05:00:0”;
nvidiaBusId = “PCI:01:00:0”;
};
}
Which itself pulls ../../../common/gpu/nvidia/default.nix:
{ lib, ... }:
{ services.xserver.videoDrivers = lib.mkDefault [ "nvidia" ]; }
../../../common/gpu/nvidia/prime.nix:
{ lib, config, ... }:
{
imports = [ ./. ];
options = {
hardware.nvidia.primeBatterySaverSpecialisation = lib.mkEnableOption "configure a specialisation which turns on NVIDIA Prime battery saver";
};
config = {
hardware.nvidia.prime = {
offload = {
enable = lib.mkOverride 990 true;
enableOffloadCmd = lib.mkIf config.hardware.nvidia.prime.offload.enable true; # Provides `nvidia-offload` command.
};
# Hardware should specify the bus ID for intel/nvidia devices
};
specialisation = lib.mkIf config.hardware.nvidia.primeBatterySaverSpecialisation {
battery-saver.configuration = {
system.nixos.tags = [ "battery-saver" ];
imports = [
# Leave only the integrated GPU enabled
./disable.nix
];
hardware.nvidia = {
prime.offload.enable = lib.mkForce false;
powerManagement = {
enable = lib.mkForce false;
finegrained = lib.mkForce false;
};
};
};
};
};
}
And ../../../common/gpu/nvidia/ampere/default.nix between other not so relevant to this topic files( I think)
{ lib, config, ... }:
let
nvidiaPackage = config.hardware.nvidia.package;
in
{
imports = [ ../. ];
# enable the open source drivers if the package supports it
hardware.nvidia.open = lib.mkOverride 990 (nvidiaPackage ? open && nvidiaPackage ? firmware);
}
Then I have this custom nvidia.nix module of my config where I explicitly try to force Sync Mode from the previously mentioned asus rog nixos-hardware.
{
lib,
config,
pkgs,
...
}:
{
hardware.nvidia = {
#Added this to avoid GPU going idle
powerManagement = {
finegrained = lib.mkForce false;
enable = lib.mkForce true;
};
#I think this is redundant
modesetting.enable = lib.mkForce true;
};
hardware.nvidia.prime = {
#Added this to enable sync and remove offload
sync.enable = lib.mkForce true;
offload.enable = lib.mkForce false;
offload.enableOffloadCmd = lib.mkForce false;
};
services.xserver.enable = true;
#Added this according to https://wiki.nixos.org/wiki/NVIDIA but ideally I'd like to start graphical session with startx
# displayManager.startx.enable = true;
services.xserver.displayManager.lightdm.enable = true;
}
This is the glxinfo -B output:
glx: failed to create dri3 screen
failed to load driver: nouveau
samba@samba:~/ > glxinfo -B
name of display: :0
glx: failed to create dri3 screen
failed to load driver: nouveau
display: :0 screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
Vendor: Mesa (0xffffffff)
Device: llvmpipe (LLVM 19.1.7, 256 bits) (0xffffffff)
Version: 25.0.7
Accelerated: no
Video memory: 31509MB
Unified memory: yes
Preferred profile: core (0x1)
Max core profile version: 4.5
Max compat profile version: 4.5
Max GLES1 profile version: 1.1
Max GLES[23] profile version: 3.2
Memory info (GL_ATI_meminfo):
VBO free memory - total: 31 MB, largest block: 31 MB
VBO free aux. memory - total: 25459 MB, largest block: 25459 MB
Texture free memory - total: 31 MB, largest block: 31 MB
Texture free aux. memory - total: 25459 MB, largest block: 25459 MB
Renderbuffer free memory - total: 31 MB, largest block: 31 MB
Renderbuffer free aux. memory - total: 25459 MB, largest block: 25459 MB
Memory info (GL_NVX_gpu_memory_info):
Dedicated video memory: 405477 MB
Total available memory: 436987 MB
Currently available dedicated video memory: 31 MB
OpenGL vendor string: Mesa
OpenGL renderer string: llvmpipe (LLVM 19.1.7, 256 bits)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 25.0.7
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL version string: 4.5 (Compatibility Profile) Mesa 25.0.7
OpenGL shading language version string: 4.50
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL ES profile version string: OpenGL ES 3.2 Mesa 25.0.7
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
I have now removed the nvidia kernelParams due the suggestion of @TLATER since they are redundant too.
These are some possibly relevant xorg logs cat .local/share/xorg/Xorg.0.log | grep -E -i “nvidia|nouveau|glx”
[ 42.842] Kernel command line: initrd=\EFI\nixos\5ay5v27dnka7kiki4bawxp2pph6qfq62-initrd-linux-6.12.63-initrd.efi init=/nix/store/4zvdww1wxgn8z6kf1fpla6l4zsfzgszy-nixos-system-samba-25.05.20260102.ac62194/init amd_pstate=active zswap.enabled=1 iommu=pt i2c_hid.polling_interval=0 loglevel=4 lsm=landlock,yama,bpf nvidia-drm.modeset=1 nvidia-drm.fbdev=1 nvidia.NVreg_PreserveVideoMemoryAllocations=1 nvidia.NVreg_OpenRmEnableUnsupportedGpus=1
[ 42.845] (**) |-->Screen "Screen-nvidia[0]" (0)
[ 42.845] (**) | |-->Device "Device-nvidia[0]"
[ 42.845] (==) No monitor specified for screen "Screen-nvidia[0]".
[ 42.853] (**) ModulePath set to "/nix/store/i68swddsbcdkn34cc7xnc4l8xfmh95bz-xf86-video-amdgpu-23.0.0/lib/xorg/modules,/nix/store/4wjwpwd6dk3yv8pjhd4ma3m55hwnajrg-nvidia-x11-570.195.03-6.12.63-bin/lib/xorg/modules,/nix/store/f9nyq02plppm68j3w5if3sb7ndk7s45w-xorg-server-21.1.20/lib/xorg/modules,/nix/store/zaw3g17n2r7p0qpls8p02l71k9brvw4j-xf86-input-evdev-2.11.0/lib/xorg/modules,/nix/store/m566lnbn44fkizbx6hz2b2ag8yz2s8xb-xf86-input-wacom-1.2.3/lib/xorg/modules,/nix/store/xjgpgdq9i9m8pym1k7wf0zjf2ijzi5wl-xf86-input-libinput-1.5.0/lib/xorg/modules"
[ 42.867] (II) "glx" will be loaded by default.
[ 42.867] (II) LoadModule: "glx"
[ 42.871] (II) Loading /nix/store/f9nyq02plppm68j3w5if3sb7ndk7s45w-xorg-server-21.1.20/lib/xorg/modules/extensions/libglx.so
[ 42.877] (II) Module glx: vendor="X.Org Foundation"
[ 42.877] (II) LoadModule: "nvidia"
[ 42.877] (II) Loading /nix/store/4wjwpwd6dk3yv8pjhd4ma3m55hwnajrg-nvidia-x11-570.195.03-6.12.63-bin/lib/xorg/modules/drivers/nvidia_drv.so
[ 42.881] (II) Module nvidia: vendor="NVIDIA Corporation"
[ 42.884] (II) NVIDIA dlloader X Driver 570.195.03 Sat Sep 20 00:39:17 UTC 2025
[ 42.884] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[ 42.890] (II) NVIDIA(0): Creating default Display subsection in Screen section
"Screen-nvidia[0]" for depth/fbbpp 24/32
[ 42.890] (==) NVIDIA(0): Depth 24, (==) framebuffer bpp 32
[ 42.890] (==) NVIDIA(0): RGB weight 888
[ 42.890] (==) NVIDIA(0): Default visual is TrueColor
[ 42.890] (==) NVIDIA(0): Using gamma correction (1.0, 1.0, 1.0)
[ 42.890] (**) NVIDIA(0): Option "AllowEmptyInitialConfiguration"
[ 42.890] (**) NVIDIA(0): Option "SidebandSocketPath" "/run/nvidia-xdriver/"
[ 42.890] (**) NVIDIA(0): Enabling 2D acceleration
[ 42.890] (II) Loading sub module "glxserver_nvidia"
[ 42.890] (II) LoadModule: "glxserver_nvidia"
[ 42.891] (II) Loading /nix/store/4wjwpwd6dk3yv8pjhd4ma3m55hwnajrg-nvidia-x11-570.195.03-6.12.63-bin/lib/xorg/modules/extensions/libglxserver_nvidia.so
[ 42.980] (II) Module glxserver_nvidia: vendor="NVIDIA Corporation"
[ 42.980] (II) NVIDIA GLX Module 570.195.03 Sat Sep 20 00:38:46 UTC 2025
[ 42.981] (II) NVIDIA: The X server supports PRIME Render Offload.
[ 42.988] (--) NVIDIA(0): Valid display device(s) on GPU-0 at PCI:1:0:0
[ 42.988] (--) NVIDIA(0): DFP-0
[ 42.988] (--) NVIDIA(0): DFP-1
[ 43.008] (II) NVIDIA(0): NVIDIA GPU NVIDIA GeForce RTX 3070 Laptop GPU (GA104-A) at
[ 43.008] (II) NVIDIA(0): PCI:1:0:0 (GPU-0)
[ 43.008] (--) NVIDIA(0): Memory: 8388608 kBytes
[ 43.008] (--) NVIDIA(0): VideoBIOS: 94.04.3e.00.a1
[ 43.008] (II) NVIDIA(0): Detected PCI Express Link width: 16X
[ 43.009] (--) NVIDIA(GPU-0): DFP-0: disconnected
[ 43.009] (--) NVIDIA(GPU-0): DFP-0: Internal DisplayPort
[ 43.009] (--) NVIDIA(GPU-0): DFP-0: 2670.0 MHz maximum pixel clock
[ 43.009] (--) NVIDIA(GPU-0):
[ 43.009] (--) NVIDIA(GPU-0): DFP-1: disconnected
[ 43.009] (--) NVIDIA(GPU-0): DFP-1: Internal TMDS
[ 43.009] (--) NVIDIA(GPU-0): DFP-1: 165.0 MHz maximum pixel clock
[ 43.009] (--) NVIDIA(GPU-0):
[ 43.009] (==) NVIDIA(0):
[ 43.009] (==) NVIDIA(0): No modes were requested; the default mode "nvidia-auto-select"
[ 43.009] (==) NVIDIA(0): will be used as the requested mode.
[ 43.009] (==) NVIDIA(0):
[ 43.009] (--) NVIDIA(0): No enabled display devices found; starting anyway because
[ 43.009] (--) NVIDIA(0): AllowEmptyInitialConfiguration is enabled
[ 43.017] (II) NVIDIA(0): Validated MetaModes:
[ 43.017] (II) NVIDIA(0): "NULL"
[ 43.017] (II) NVIDIA(0): Virtual screen size determined to be 640 x 480
[ 43.017] (WW) NVIDIA(0): Unable to get display device for DPI computation.
[ 43.017] (==) NVIDIA(0): DPI set to (75, 75); computed from built-in default
[ 43.256] (II) AMDGPU(G0): glamor: Using OpenGL 4.6 context.
[ 43.263] (II) NVIDIA: Reserving 24576.00 MB of virtual memory for indirect memory
[ 43.263] (II) NVIDIA: access.
[ 43.284] (WW) NVIDIA(0): ACPI: failed to determine the system's current power source
[ 43.311] (II) NVIDIA(0): Setting mode "NULL"
[ 43.377] (==) NVIDIA(0): Disabling shared memory pixmaps
[ 43.377] (==) NVIDIA(0): Backing store enabled
[ 43.377] (==) NVIDIA(0): Silken mouse enabled
[ 43.377] (==) NVIDIA(0): DPMS enabled
[ 43.377] (WW) NVIDIA(0): Option "DRI" is not used
[ 43.377] (WW) NVIDIA(0): Option "RandRRotation" is not used
[ 43.377] (II) NVIDIA(0): [DRI2] Setup complete
[ 43.377] (II) NVIDIA(0): [DRI2] VDPAU driver: nvidia
[ 43.425] (II) Initializing extension GLX
[ 43.439] (II) IGLX: Loaded and initialized swrast
[ 43.439] (II) GLX: Initialized DRISWRAST GL provider for screen 0
[ 43.439] (II) Initializing extension GLX
[ 43.439] (II) Indirect GLX disabled.
[ 43.439] (II) GLX: Another vendor is already registered for screen 0
[ 43.439] (II) Initializing extension NV-GLX
[ 43.627] (II) config/udev: Adding input device HDA NVidia HDMI/DP,pcm=3 (/dev/input/event11)
[ 43.627] (II) config/udev: Adding input device HDA NVidia HDMI/DP,pcm=7 (/dev/input/event12)
[ 43.628] (II) config/udev: Adding input device HDA NVidia HDMI/DP,pcm=8 (/dev/input/event13)
[ 43.628] (II) config/udev: Adding input device HDA NVidia HDMI/DP,pcm=9 (/dev/input/event14)
[ 51.871] (--) NVIDIA(GPU-0): DFP-0: disconnected
[ 51.871] (--) NVIDIA(GPU-0): DFP-0: Internal DisplayPort
[ 51.871] (--) NVIDIA(GPU-0): DFP-0: 2670.0 MHz maximum pixel clock
[ 51.871] (--) NVIDIA(GPU-0):
[ 51.873] (--) NVIDIA(GPU-0): DFP-1: disconnected
[ 51.873] (--) NVIDIA(GPU-0): DFP-1: Internal TMDS
[ 51.873] (--) NVIDIA(GPU-0): DFP-1: 165.0 MHz maximum pixel clock
[ 51.873] (--) NVIDIA(GPU-0):
[ 51.896] (II) NVIDIA(0): Setting mode "NULL"
[ 51.911] (WW) NVIDIA(0): ACPI: failed to determine the system's current power source
[ 66.248] (--) NVIDIA(GPU-0): DFP-0: disconnected
[ 66.248] (--) NVIDIA(GPU-0): DFP-0: Internal DisplayPort
[ 66.248] (--) NVIDIA(GPU-0): DFP-0: 2670.0 MHz maximum pixel clock
[ 66.248] (--) NVIDIA(GPU-0):
[ 66.251] (--) NVIDIA(GPU-0): DFP-1: disconnected
[ 66.251] (--) NVIDIA(GPU-0): DFP-1: Internal TMDS
[ 66.251] (--) NVIDIA(GPU-0): DFP-1: 165.0 MHz maximum pixel clock
[ 66.251] (--) NVIDIA(GPU-0):
[ 66.291] (II) NVIDIA(0): Setting mode "NULL"
[ 66.306] (WW) NVIDIA(0): ACPI: failed to determine the system's current power source
[ 73.188] (II) NVIDIA(GPU-0): Deleting GPU-0
Any ideas of how could I correctly configure the sync profile on this AMD+NVIDIA x11 laptop?