I've tried to follow this wiki NVIDIA/Optimus to set nvidia optimus up. I've switched from fx86-video-intel to fx86-video-modesetting by adding the following lines into my make.conf file.

VIDEO_CARDS="intel i965 iris nvidia"
INPUT_DEVICES="libinput synaptics"

Originally after I did this X server wouldn't start so I made a post asking for help.
But nvidia offloading didn't work so I removed all the files under /etc/X11/ and /usr/share/X11 and tried to write my own X config files to make it work, but I wasn't successful at my attempt on getting nvidia offloading to work so I had my friend send me his config files because they were gentoo stock config files, as I forgot to make a backup of my original config files non intentionally.

I've tried to follow this guide as described here but I got a black screen and a segfault.
https://forums.gentoo.org/viewtopic-p-8458394.html#8458394

I found this Xorg.0.log but I'm unsure if it's the same one from the image that I linked because I'm using modesetting right now.
https://paste.gg/p/anonymous/d90708f7bcc04187a5c4bfb33920beb1/files/abf3d135c02a4cbd8cdd3db38651d8fc/raw

I have an ASUS X541nc laptop, xrandr doesn't detect my nvidia card.

xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x45 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 3 outputs: 3 associated providers: 0 name:modesetting
Provider 1: id: 0xb1 cap: 0x0 crtcs: 0 outputs: 0 associated providers: 0 name:modesetting

But the nvidia-smi does
https://paste.gg/p/anonymous/fbb4a4dc92494f7481d9817a970ed666/files/aaeb148eeaad45acae02129dba61d229/raw

How to get nvidia offloading to work properly, right now I can get only intel to work with the default gentoo configuration without xorg.conf file that tries to setup nvidia, deleting that enables intel modesetting to be used by default.

Regards