Nvidia drivers not loaded, not working

I’d like to make my GPU work, at least when I want it to, but despite the nvidia drivers being installed (via mhwd -a pci nonfree 0300) it still shows that they are not loaded and it seems that the gpu never does any work. The output of “nvidia-smi”:
> ±----------------------------------------------------------------------------+

| NVIDIA-SMI 460.39       Driver Version: 460.39       CUDA Version: 11.2     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 1050    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   48C    P0    N/A /  N/A |      0MiB /  4042MiB |      1%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

nvidia-settings (it worked before, after reinstalling drivers it shows that, no matter what):

Gtk-Message: 13:37:01.227: Failed to load module “appmenu-gtk-module”

ERROR: Unable to load info from any available system

mhwd -li:

> Installed PCI configs:
> --------------------------------------------------------------------------------
>                   NAME               VERSION          FREEDRIVER           TYPE
> --------------------------------------------------------------------------------
> video-hybrid-intel-nvidia-prime            2020.11.30               false            PCI
>      video-modesetting            2020.01.13                true            PCI

inxi -G:

Graphics:  Device-1: Intel UHD Graphics 630 driver: i915 v: kernel 
           Device-2: NVIDIA GP107M [GeForce GTX 1050 Mobile] driver: nvidia v: 460.39 
           Device-3: IMC Networks USB2.0 HD UVC WebCam type: USB driver: uvcvideo 
           Display: x11 server: X.Org 1.20.10 driver: loaded: modesetting resolution: 1920x1080~60Hz 
           OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2) v: 4.6 Mesa 20.3.4

prime-run inxi -G:

Graphics:  Device-1: Intel UHD Graphics 630 driver: i915 v: kernel 
           Device-2: NVIDIA GP107M [GeForce GTX 1050 Mobile] driver: nvidia v: 460.39 
           Device-3: IMC Networks USB2.0 HD UVC WebCam type: USB driver: uvcvideo 
           Display: x11 server: X.Org 1.20.10 driver: loaded: modesetting resolution: 1920x1080~60Hz 
           OpenGL: renderer: N/A v: N/A

Running “sudo nvidia-xonfig” makes it so that after reboot the x server doesn’t load and cannot be started from tty.

How do I make the gpu work instead of integrated graphics in games and other cases? I wouldn’t mind if it worked all the time, though it’s a laptop so for energy saving reasons the ability to change gpu at will is preffered. I already tried reinstalling the drivers, tried the alternatives, the outcome is always the same - the nvidia gpu is off.

Never do that. Don’t use sudo for nvidia-settings.

prime-run <application>
is what you are looking for …

Well, I never did use sudo with “nvidia-settings” - it doesn’t even work as shown above. I don’t know whether I should use it or not, but I believe “nvidia-xconfig” requires sudo because it writes to /etc/X11 folder.

How do I check if the GPU is used / monitor its usage? I tried running programs with and without prime-run and checking it with nvidia-smi since I see some percentages there, but there is no difference at all. Also “prime-run inxi -G” shows “N/A” in the renderer field, should it do so?