How does one build a coq_proj.opam file automatically from a successfully compile local version?

I want the coq_proj.opam file to have a union of:

  • coq ver – so dependencies
  • git repo commit it depends (and so the version of opam coq-proj)
  • ocaml compiler (& switch e.g. opam switch create coq-8.14.1 4.07.1)
  • switch name (name e.g. oq-8.14.1)
  • build (& install?) command for coq-proj (make clean or an opam comman e.g. opam reinstall) – likely has _CoqMake (or Make or remake) and MakeFile (based on Official place to learn how to setup Coq make files for beginner - Using Coq - Coq)

I assume the file would look something like this:

opam-version: "2.0"  #automatically obtained I assume

homepage: "https://github.com/username/coq-proj-repo-name"
dev-repo: "git+https://github.com/username/coq-proj-repo-name.git"
# of course the actual official ways to get them the build works
commit: TODO-how to get?
opam-coq-proj-version: TODO-how to get?
compiler-ocaml: TODO how to get?

version: "dev"

# why both? :/
build: [make "-j%{jobs}%"]
install: [make "install"]

depends: [
  "ocaml"
  "coq" {(>= "8.11" & < "8.12~") | (= "dev")}
]

tags: ["coq-project"]
authors: ["Auto_opam_build_tool"]


note I don’t know how to things with dune. I know how to use Make based on this: Official place to learn how to setup Coq make files for beginner - Using Coq - Coq