Hello, I’m new to NixOS, I’m using i3 and I don’t get both monitors to run at the same time.
One monitor is connected to the Intel GPU and the other one directly to my Nvidia GPU.
If I only install either Nvidia or Intel drivers, only one monitor works.
Usually I would just install both drivers and both monitors would work from my experience, but when I do so, no monitor works anymore and I just get a black screen.
I set up Prime, I configured X11 and I’m out of ideas.
Does anyone have an idea?
I’m thankful for any help.
My configuration.nix:
{ config, pkgs, lib, ... }:
let
isNvidia = true;
isIntel = true;
enablePrime = true;
in
{
imports =
[
./hardware-configuration.nix
];
##### Driver #####
services.xserver.videoDrivers = []
++ lib.optional isNvidia "nvidia"
++ lib.optional isIntel "modesetting";
# Intel
hardware.graphics = {
enable = isIntel;
extraPackages = with pkgs; [
vpl-gpu-rt
];
};
# Nvidia
hardware.nvidia = if isNvidia then {
modesetting.enable = true;
powerManagement = {
enable = true;
finegrained = false;
};
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
# Prime
prime = if enablePrime then {
# Sync
sync.enable = false;
# Offload
offload.enable = true;
offload.enableOffloadCmd = true;
# Tip: sudo lshw -c display
intelBusId = "PCI:0@0:2:0";
nvidiaBusId = "PCI:1@0:0:0";
# amdgpuBusId = "PCI:0:0:0";
} else {};
} else {};
hardware.nvidia-container-toolkit.enable = isNvidia;
...
services.xserver = {
enable = true;
desktopManager = {
xterm.enable = false;
};
displayManager = {
lightdm.enable = true;
defaultSession = "none+i3";
};
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
dmenu
i3status
i3lock
i3blocks
];
package = pkgs.i3-gaps;
};
xkb = {
layout = "us";
variant = "";
};
};
My xorg.conf:
Section "ServerLayout"
Identifier "Main Layout"
Screen 0 "Screen0" Absolute 0
Screen 1 "Screen1" LeftOf "Screen0"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
ModulePath "/nix/store/sgzwfb9k14myjfdxmz7zg6wqhb7mi0d9-xorg-server-21.1.14/lib/xorg/modules"
FontPath ""
EndSection
Section "Module"
Load "nvidia"
Load "glx"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5 6 7"
EndSection
Section "Monitor"
Identifier "DP-1"
VendorName "Vendor"
ModelName "Model"
Option "Primary" "true"
Option "PreferredMode" "2560x1440"
Option "Postion" "1920 0"
Option "RightOf" "HDMI-0"
EndSection
Section "Monitor"
Identifier "HDMI-0"
VendorName "Vendor"
ModelName "Model"
Option "PreferredMode" "1920x1080"
EndSection
Section "Device"
Option "PrimaryGPU" "true"
Identifier "Card0"
Driver "modesetting"
BusID "PCI:0@0:2:0"
EndSection
Section "Device"
Identifier "Card1"
Driver "nvidia"
BusID "PCI:1@0:0:0"
EndSection
Section "Screen"
Identifier "Screen1"
Device "Card1"
Monitor "HDMI-1"
Depth 32
Mode "1920x1080"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "DP-1"
Depth 32
Mode "2560x1440"
EndSection