mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-05 10:56:56 -05:00
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 @@ (define-public rust
|
|||
(copy-recursively "src" (string-append out dest "/src")))))
|
||||
(add-after 'install-rust-src 'wrap-rust-analyzer
|
||||
(lambda* (#:key outputs #:allow-other-keys)
|
||||
(wrap-program (string-append (assoc-ref outputs "tools")
|
||||
"/bin/rust-analyzer")
|
||||
`("RUST_SRC_PATH" ":" =
|
||||
(,(string-append (assoc-ref outputs "rust-src")
|
||||
"/lib/rustlib/src/rust/library"))))))))))
|
||||
(let ((bin (string-append (assoc-ref outputs "tools") "/bin")))
|
||||
(rename-file (string-append bin "/rust-analyzer")
|
||||
(string-append bin "/.rust-analyzer-real"))
|
||||
(call-with-output-file (string-append bin "/rust-analyzer")
|
||||
(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.
|
||||
(native-inputs (cons* `("gdb" ,gdb/pinned)
|
||||
`("procps" ,procps)
|
||||
|
|
Loading…
Reference in a new issue