diff --git a/README.org b/README.org index 1844d34..9139fe5 100644 --- a/README.org +++ b/README.org @@ -28,3 +28,44 @@ your ~~/.config/guix/channels.scm~, and call ~guix pull~. %default-channels) #+end_src +** Usage + +*** For stable Rusts +#+begin_src shell + guix search rust-bin +#+end_src + +*** For latest nightly/beta +#+begin_src + guix build -e '((@@ (rustup build toolchain) rustup) "stable")' + guix build -e '((@@ (rustup build toolchain) rustup) "beta")' + guix build -e '((@@ (rustup build toolchain) rustup) "nightly")' +#+end_src + +*** With =guix shell= =manifest.scm= + +#+begin_src scheme + (use-modules (rustup build toolchain)) + + ;; (packages->manifest (list (rustup "nightly-2024-05-18"))) + + (packages->manifest (list (rustup))) +#+end_src + +*** Rustup toolchain file +=rustup-toolchain= +=rustup-toolchain.toml= + +Procedure =rustup= will search for these two file in parent folders like +=guix shell= search for =mainfest.scm= file. You can manully specify the +location of the toolchain file with =(rustup "path/to/rust-toolchain")= + +*** =rustup= arguments +#+begin_src scheme + (define* (rustup #:optional (channel-or-toolchain-file #f) + #:key + (components (list )) + (targets (list )) + (profile 'default)) + ...) +#+end_src diff --git a/guix/rustup/build/manifest.scm b/guix/rustup/build/manifest.scm index bf314a8..fbc8c4e 100644 --- a/guix/rustup/build/manifest.scm +++ b/guix/rustup/build/manifest.scm @@ -509,7 +509,9 @@ (define* (compact-manifest str #:optional manifest) (define c (channel->from-str str)) (define channel (channel->name c)) - (define date (channel->date c)) + (define date (or (channel->date c) (recursive-assoc-ref + manifest + `("date")))) (define* (compact-manifest data) (define toolchain-version (car (string-split diff --git a/guix/rustup/build/toolchain.scm b/guix/rustup/build/toolchain.scm index ed33c99..66807e8 100644 --- a/guix/rustup/build/toolchain.scm +++ b/guix/rustup/build/toolchain.scm @@ -139,9 +139,11 @@ aliased-str)) (define _channel-name (channel->name channel)) (define _channel-date (channel->date channel)) - (define _var (module-variable - (resolve-module `(rustup dist ,(string->symbol _channel-date))) - (string->symbol (channel-str-normalize _channel-name)))) + (define _var (if _channel-date + (module-variable + (resolve-module `(rustup dist ,(string->symbol _channel-date))) + (string->symbol (channel-str-normalize _channel-name))) + #f)) (define _data (cond (_var (variable-ref _var)) (else