rust: Check if environment already mounted

This commit is contained in:
Davie Li 2024-02-04 19:08:34 +01:00
parent a2ea1192f3
commit 9d574fcdd1
Signed by: davie
GPG key ID: 29FD88532FC91BF4

9
env/rust.scm vendored
View file

@ -180,13 +180,14 @@ function."
(let* ((target (string-append (@@ (env) %env-directory)
"/" (symbol->string target-sym)))
;; TODO should actually detect if overlay is mounted not that the
;; directory exists.
(mnt (mount-environment env #:tag onto #:target target))
(mnt (if (environment-mounted? env)
(or (environment->overlay-mount-maybe env)
(throw 'wrong-mount?))
(mount-environment env #:tag onto #:target target)))
(mappings (append (map (remap #f) expose)
(map (remap #t) share))))
(exec-in-rustup-environment '("./.cargo/bin/rust-analyzer")
#:home mnt
#:home (overlay-mount-merged mnt)
#:mappings mappings)
(sync)
(system* "umount" target)