Skip to content

Commit

Permalink
Add some docs
Browse files Browse the repository at this point in the history
  • Loading branch information
declantsien committed May 22, 2024
1 parent 7cc0355 commit 26263fb
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 4 deletions.
41 changes: 41 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 3 additions & 1 deletion guix/rustup/build/manifest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions guix/rustup/build/toolchain.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 26263fb

Please sign in to comment.