Nvidia_oc cannot find libnvidia-ml.so

Hello!
I’ve been trying to overclock my nvidia card on wayland but this error keeps popping up.
"libnvidia-ml.so: cannot open shared object file: No such file or directory"

What’s weird is that a symlink for libnvidia-ml.so does exist in /run/opengl-driver/lib/

I tried to get around the problem by using env variable LD_PRELOAD=/run/opengl-driver/lib/libnvidia-ml.so with nvidia_oc but nvidia_oc still throws the same error.
I also had this same issue with MangoHud but putting the env variable LD_PRELOAD=/run/opengl-driver/lib/libnvidia-ml.so.1 with MangoHud resolved the issue.

The error that nvidia_oc throws:

$ sudo nvidia_oc set --index 0 --mem-offset 100
thread 'main' panicked at src/main.rs:98:37:
Failed to initialize NVML: LibloadingError(DlOpen { desc: "libnvidia-ml.so: cannot open shared object file: No such file or directory" })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

and running with RUST_BACKTRACE=full:

$ sudo RUST_BACKTRACE=full nvidia_oc set --index 0 --mem-offset 100
thread 'main' panicked at src/main.rs:98:37:
Failed to initialize NVML: LibloadingError(DlOpen { desc: "libnvidia-ml.so: cannot open shared object file: No such file or directory" })
stack backtrace:
   0:     0x587e6f48c599 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h2f5a6b58013db6e9
   1:     0x587e6f4aad73 - core::fmt::write::hfa96557f28429d69
   2:     0x587e6f4775b3 - std::io::Write::write_fmt::h37f3912886494215
   3:     0x587e6f48c3e3 - std::sys::backtrace::BacktraceLock::print::h82a3e77ee14f93d1
   4:     0x587e6f47ec23 - std::panicking::default_hook::{{closure}}::h4089ac0fd21dfdaa
   5:     0x587e6f47ea07 - std::panicking::default_hook::hde6b2b92b4b8a422
   6:     0x587e6f47f094 - std::panicking::rust_panic_with_hook::h04d84002b0e420ae
   7:     0x587e6f48cfba - std::panicking::begin_panic_handler::{{closure}}::hf0b93ce775256187
   8:     0x587e6f48c7c9 - std::sys::backtrace::__rust_end_short_backtrace::h13db8456c52fd998
   9:     0x587e6f47ecbc - rust_begin_unwind
  10:     0x587e6f38ff80 - core::panicking::panic_fmt::hce616224d24d1eda
  11:     0x587e6f390606 - core::result::unwrap_failed::h9cc259c02bc97d88
  12:     0x587e6f3a8942 - nvidia_oc::main::h30647c683e090473
  13:     0x587e6f3bc743 - std::sys::backtrace::__rust_begin_short_backtrace::he72b2e7bb79bb75f
  14:     0x587e6f3b6b69 - std::rt::lang_start::{{closure}}::he3130ae4d3ecf2a6
  15:     0x587e6f4612b0 - std::rt::lang_start_internal::h883ae27d2b78cab4
  16:     0x587e6f3acac5 - main
  17:     0x7a40ea82a1fc - __libc_start_call_main
  18:     0x7a40ea82a2b9 - __libc_start_main_alias_2
  19:     0x587e6f3906c5 - _start
  20:                0x0 - <unknown>

Additional information:

nix-info -m:

 - system: `"x86_64-linux"`
 - host os: `Linux 6.12.2-lqx3, NixOS, 25.05 (Warbler), 25.05beta733374.8f3e1f807051`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.11`
 - channels(root): `"nixos"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

xserver in configuration.nix is enabled.

nvidia snippet from configuration.nix:

hardware.opengl = {
  enable = true;
  };
  services.xserver.videoDrivers = ["nvidia"];

  hardware.nvidia = {
  modesetting.enable = true; # required
  
  powerManagement = {
  enable = true;
  finegrained = true;
  };

  prime = {
    offload = {
      enable = true;
      enableOffloadCmd = true;
    };
    intelBusId = "PCI:0:2:0";
    nvidiaBusId = "PCI:1:0:0";
  };
  
  open = false;
  nvidiaSettings = true;
  package = config.boot.kernelPackages.nvidiaPackages.beta;
  };

nvidia-settings says:
NVIDIA Driver Version: 565.77
NVML Version: 12.565.77