Trouble running `opam init` inside nix shell

Hey, I’m trying to init the opam inside a nix shell (through nix develop), but having an error to run it.

opam init -v -v 

No configuration file found, using built-in defaults.
Checking for available remotes: rsync and local, git.
  - you won't be able to use mercurial repositories unless you install the hg command on your system.
  - you won't be able to use darcs repositories unless you install the darcs command on your system.

+ /Users/noghartt/.opam/opam-init/hooks/sandbox.sh "build" "sh" "-c" "echo SUCCESS | tee check-write"
- SUCCESS

<><> Fetching repository information ><><><><><><><><><><><><><><><><><><><>  🐫 
[ERROR] Could not update repository "default": "": command not found.
[ERROR] Initial download of repository failed.

Any idea what is happening and why I can’t init the opam? Or how can I debug it?

After running it through opam init git+https://github.com/ocaml/opam-repository.git, it works and pass this step, but having another error now:

[ERROR] Failed to get extra source "gen_ocaml_config.ml.in" of ocaml-config.3: Download failed
[ERROR] Failed to get extra source "gen_ocaml_config.ml.in" of ocaml-system.5.1.1: Download failed
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
∗ installed host-arch-arm64.1
∗ installed host-system-other.1

#=== ERROR while fetching sources for ocaml-system.5.1.1 ======================#
OpamSolution.Fetch_fail("https://raw.githubusercontent.com/ocaml/opam-source-archives/main/patches/ocaml-system/gen_ocaml_config.ml.in (download failed)")

#=== ERROR while fetching sources for ocaml-config.3 ==========================#
OpamSolution.Fetch_fail("https://raw.githubusercontent.com/ocaml/opam-source-archives/main/patches/ocaml-config/gen_ocaml_config.ml.in.3 (download failed)")


<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  🐫 
┌─ The following actions failed
│ ⬇ fetch ocaml-config 3
│ ⬇ fetch ocaml-system 5.1.1
└─ 
┌─ The following changes have been performed (the rest was aborted)
│ ∗ install base-bigarray     base
│ ∗ install base-threads      base
│ ∗ install base-unix         base
│ ∗ install host-arch-arm64   1
│ ∗ install host-system-other 1
└─ 
# Run eval $(opam env --switch=default) to update the current shell environment
Switch initialisation failed: clean up? ('n' will leave the switch partially installed) [y/n] y
[NOTE] Opam has been initialised, but the initial switch creation failed.
       Use 'opam switch create <compiler>' to get started.

could you open a ticket at Issues · ocaml/opam · GitHub with the output of opam init -vvv --debug-level=3 ?