rust: Use mounted directory when present

This commit is contained in:
Davie Li 2024-01-15 18:30:26 +01:00
parent 0be12f9a87
commit 1fdebc187c
Signed by: davie
GPG key ID: 29FD88532FC91BF4

9
env/rust.scm vendored
View file

@ -171,11 +171,16 @@ function."
(throw 'file-doesnt-exist))))))))
(let* ((target (string-append (@@ (env) %env-directory) "/" target-name))
(mnt (mount-environment env #:tag tag #:target target))
;; TODO should actually detect if overlay is mounted not that the
;; directory exists.
(mnt (if (file-exists? target)
target
(overlay-mount-merged
(mount-environment env #:tag tag #:target target))))
(mappings (append (map (remap #f) expose)
(map (remap #t) share))))
(exec-in-rustup-environment '("./.cargo/bin/rust-analyzer")
#:home (overlay-mount-merged mnt)
#:home mnt
#:mappings mappings)
(sync)
(system* "umount" target)