gnu: rust: Allow using custom rust-src for rust-analyzer.
* gnu/packages/rust.scm (rust)[arguments]: Rewrite 'wrap-rust-analyzer phase to allow using a custom RUST_SRC_PATH. Change-Id: Id811bc8d09c0f955ece9c9e6267a0ae96e61f105
This commit is contained in:
parent
4b0fcbd00a
commit
273bd81188
1 changed files with 13 additions and 5 deletions
|
@ -1030,11 +1030,19 @@ safety and thread safety guarantees.")
|
||||||
(copy-recursively "src" (string-append out dest "/src")))))
|
(copy-recursively "src" (string-append out dest "/src")))))
|
||||||
(add-after 'install-rust-src 'wrap-rust-analyzer
|
(add-after 'install-rust-src 'wrap-rust-analyzer
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
(wrap-program (string-append (assoc-ref outputs "tools")
|
(let ((bin (string-append (assoc-ref outputs "tools") "/bin")))
|
||||||
"/bin/rust-analyzer")
|
(rename-file (string-append bin "/rust-analyzer")
|
||||||
`("RUST_SRC_PATH" ":" =
|
(string-append bin "/.rust-analyzer-real"))
|
||||||
(,(string-append (assoc-ref outputs "rust-src")
|
(call-with-output-file (string-append bin "/rust-analyzer")
|
||||||
"/lib/rustlib/src/rust/library"))))))))))
|
(lambda (port)
|
||||||
|
(format port "#!~a
|
||||||
|
if test -z \"${RUST_SRC_PATH}\";then export RUST_SRC_PATH=~S;fi;
|
||||||
|
exec -a \"$0\" \"~a\" \"$@\""
|
||||||
|
(which "bash")
|
||||||
|
(string-append (assoc-ref outputs "rust-src")
|
||||||
|
"/lib/rustlib/src/rust/library")
|
||||||
|
(string-append bin "/.rust-analyzer-real"))))
|
||||||
|
(chmod (string-append bin "/rust-analyzer") #o755))))))))
|
||||||
;; Add test inputs.
|
;; Add test inputs.
|
||||||
(native-inputs (cons* `("gdb" ,gdb/pinned)
|
(native-inputs (cons* `("gdb" ,gdb/pinned)
|
||||||
`("procps" ,procps)
|
`("procps" ,procps)
|
||||||
|
|
Reference in a new issue