Cannot build guix package with cargo build system where the cargo package to be built has a git dependency

I’m trying to build fetchit so I can put it on my guix channel.

However, I get the following error:

$ guix build -L ~/Nwaȥ/Êsaj/Giks/yrop/ fetchit
...
starting phase `build'
error: failed to get `ant-core` as a dependency of package `fetchit-net v0.2.0 (/tmp/guix-build-fetchit-0.2.8.drv-0/source/crates/fetchit-net)`

Caused by:
  failed to load source for dependency `ant-core`

Caused by:
  Unable to update https://github.com/WithAutonomi/ant-client?rev=3df6764

Caused by:
  can't checkout from 'https://github.com/WithAutonomi/ant-client': you are in the offline mode (--offline)
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "cargo" arguments: ("build" "--offline" "-j" "4" "--release") exit-status: 101 term-signal: #f stop-signal: #f> 
phase `build' failed after 0.4 seconds
command "cargo" "build" "--offline" "-j" "4" "--release" failed with status 101
build process 6 exited with status 256
builder for `/gnu/store/n6ljiwd9fa3xngpckn5pmq0640w4908h-fetchit-0.2.8.drv' failed with exit code 1

fetchit.scm

...
  #:use-module (yrop packages ant core))


(define %fetchit-cargo-lock
  (or (search-path %load-path "yrop/files/fetchit-Cargo.lock")
      (error "could not find fetchit-Cargo.lock in load path")))

(define %cargo-inputs
  (cargo-inputs-from-lockfile %fetchit-cargo-lock))

...
(define-public fetchit
  (package
   ...
   (build-system cargo-build-system)
   ...
        (inputs (cons* (ant-core %cargo-inputs))
   ...))
...

core.scm

...
  #:export (ant-core))

(define %ant-client-cargo-lock
  (or (search-path %load-path "yrop/files/ant-client-3df6764-Cargo.lock")
      (error "could not find ant-client-3df6764-Cargo.lock in load path")))

(define %cargo-inputs
  (cargo-inputs-from-lockfile %ant-client-cargo-lock))

...
(define-public ant-core
  (package
   ...
   (build-system cargo-build-system)
   ...
         (inputs (cons* mimalloc
                   `(,zstd "lib") %cargo-inputs))
   ...))
...

Solved by creating a guix package for the git dependency and removing the [[package]] section out of the lock file, then injecting the crate and dependencies of said git dependency package separately.

fetchit-cli.scm (previously fetchit.scm)

...
#:use-module (yrop packages ant)
...
(define %path-cargo-ant-core
  (or (search-path %load-path "yrop/files/cargo/ant-client-3df6764-Cargo.lock")
      (error "could not find ant-client-3df6764-Cargo.lock in load path")))

(define %path-cargo-fetchit-cli
  (or (search-path %load-path "yrop/files/cargo/fetchit-cli-Cargo.lock")
      (error "could not find fetchit-desktop-Cargo.lock in load path")))

(define %crate-ant-core
  (file-append rust-ant-core "/share/cargo/registry/ant-core-0.2.4.crate"))

(define %inputs-cargo-ant-core
  (cargo-inputs-from-lockfile %path-cargo-ant-core))

(define %inputs-cargo-fetchit-cli
  (cargo-inputs-from-lockfile %path-cargo-fetchit-cli))
...

(define-public fetchit-cli
  (package
   ...
   (build-system cargo-build-system)
   ...
(add-after 'unpack 'use-local-ant-core
          (lambda _
            ;; A. unpack local crate 
            (mkdir "guix-ant-core")
            (invoke "tar" "xf" #$%ant-core-crate "-C" "guix-ant-core" "--strip-components=1")
            
            ;; B. substitute git source with local package
            (substitute* "Cargo.toml"
              (("ant-core = \\{ git = \"https://github.com/WithAutonomi/ant-client\", rev = \"3df6764\" \\}")
               "ant-core = { version = \"0.2.4\", path = \"guix-ant-core\" }"))
            (substitute* "crates/fetchit-core/Cargo.toml"
              (("ant-core = \\{ git = \"https://github.com/WithAutonomi/ant-client\", rev = \"3df6764\" \\}")
               "ant-core = { version = \"0.2.4\", path = \"../../guix-ant-core\" }"))
            (substitute* "crates/fetchit-net/Cargo.toml"
              (("ant-core = \\{ git = \"https://github.com/WithAutonomi/ant-client\", rev = \"3df6764\" \\}")
               "ant-core = { version = \"0.2.4\", path = \"../../guix-ant-core\" }"))
            
            ;; C. neutralize git-source further
            (substitute* "Cargo.lock"
              (("source = \"git\\+https://github.com/WithAutonomi/ant-client\\?rev=3df6764#[a-f0-9]+\"")
               "source = \"registry+https://github.com/rust-lang/crates.io-index\"")) 

            #t))
   ...     
        (inputs (append
              %inputs-cargo-fetchit-cli
              %inputs-cargo-ant-core))
   ...))