unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: Jason Conroy <conjaroy@gmail.com>
Cc: guix-devel@gnu.org
Subject: Re: rust-team branch merged
Date: Wed, 6 Mar 2024 11:06:05 +0200	[thread overview]
Message-ID: <Zegx_RGmRAnJ3sHc@3900XT> (raw)
In-Reply-To: <CABWzUjWiymAdZeNZhm+_5kYykjqm-pGTpD-3eRhA8sCgbeHEtQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4153 bytes --]

On Mon, Feb 26, 2024 at 09:24:29PM -0500, Jason Conroy wrote:
> Hello Efraim,
> 
> Thanks for investigating this - a Rust development workflow using only
> Guix-native crates is something I've been waiting for!
> 
> I was experimenting with your patches and it seems that they do pull in the
> source crates for requested packages, but not their dependencies (example
> below). Is there something I'm missing?

When you say they pull in the source crates do you mean the sources of
the other rust packages needed by rust-rand? I didn't test that, but I
assumed it wouldn't.

Currently if you were to pull in rust-rand-0.8 and rust-rand-0.7 then
you'd have both rand-0.*.crate files in the registry but only one of
them would be listed in share/cargo/registry/index/ra/nd/rand. I need to
adjust the generation of that file to combine multiple sources if they
exist, and sort them (I'm not sure it's necessary, but wouldn't be
surprised if we hit undefined behaviour if they were listed multiple
times or out of order).  I also need to figure out something with a
config.toml to see if it's possible to generate one that could be
included from another one, since you can't add 'local-registry =
$GUIX_PROFILE/...' in a toml file.

> Cheers,
> Jason
> 
> $ guix shell --pure bash findutils rust-rand -- bash -c 'find -L
> $GUIX_ENVIRONMENT/share/cargo'
> /gnu/store/zf88v65rbg2di4qhgdbvhfcjf31rdzby-profile/share/cargo
> /gnu/store/zf88v65rbg2di4qhgdbvhfcjf31rdzby-profile/share/cargo/registry
> /gnu/store/zf88v65rbg2di4qhgdbvhfcjf31rdzby-profile/share/cargo/registry/index
> /gnu/store/zf88v65rbg2di4qhgdbvhfcjf31rdzby-profile/share/cargo/registry/index/ra
> /gnu/store/zf88v65rbg2di4qhgdbvhfcjf31rdzby-profile/share/cargo/registry/index/ra/nd
> /gnu/store/zf88v65rbg2di4qhgdbvhfcjf31rdzby-profile/share/cargo/registry/index/ra/nd/rand
> /gnu/store/zf88v65rbg2di4qhgdbvhfcjf31rdzby-profile/share/cargo/registry/rand-0.8.5.crate
> /gnu/store/zf88v65rbg2di4qhgdbvhfcjf31rdzby-profile/share/cargo/registry/config.json
> 
> On Thu, Dec 14, 2023 at 10:10 AM Efraim Flashner <efraim@flashner.co.il>
> wrote:
> 
> > On Wed, Dec 13, 2023 at 10:34:11AM +0200, Efraim Flashner wrote:
> > > * Compiled rust packages currently have a 'package' phase, which runs
> > > the command used to crate a 'crate tarball', and is installed in
> > > %output/share/cargo/registry, with unpacked sources in
> > > %output/share/cargo/src.  In theory it should be possible to use these
> > > for local rust development.  The benefits include everything that comes
> > > with being a guix package, including pre-patched shebangs.  Currently no
> > > index file is created in $GUIX_ENVIRONMENT/share/cargo/registry/index,
> > > which is likely necessary to actually make use of this.  Additionally, I
> > > am unsure how to use '$GUIX_ENVIRONMENT' in ~/.cargo/config so that it
> > > is expanded and not taken as a literal string.
> >
> > In the Guix London meetup someone mentioned that they were interested in
> > playing around with using Guix for rust development.  I've adjusted the
> > cargo-build-system to produce the registry index files and I added a
> > profile hook to generate the config.json to locate the packaged crates.
> >
> > toml files can't process environment variables (which is probably a good
> > thing ...) but that means its a little harder to test out.
> >
> > with the two patches applied create an environment with the crates you
> > want and get the location of GUIX_ENVIRONMENT:
> > `env | grep GUIX_ENVIRONMENT | cut -f2 -d=`
> >
> > in ~/.cargo/config:
> > [source.crates-io]
> > local-registry = '<location of GUIX_ENVIRONMENT>/share/cargo/registry'
> >
> > 'cargo build' should pull from the local crates in the GUIX_ENVIRONMENT.
> > I'm not sure what happens if it doesn't have those crates available and
> > would need to get them from crates.io.
> >
> >

-- 
Efraim Flashner   <efraim@flashner.co.il>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2024-03-06  9:06 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13  8:34 rust-team branch merged Efraim Flashner
2023-12-13 14:02 ` Maxim Cournoyer
2023-12-14 15:10 ` Efraim Flashner
2024-02-27  2:24   ` Jason Conroy
2024-03-06  9:06     ` Efraim Flashner [this message]
2024-03-06 17:53       ` Jason Conroy
2024-03-07  8:08         ` Efraim Flashner
2024-03-07 16:48           ` Jason Conroy
2024-03-12 15:12             ` Efraim Flashner
2024-03-13 15:06               ` Jason Conroy
2024-04-18 16:54       ` Jason Conroy
2024-04-24 15:39         ` Efraim Flashner
2024-04-24 15:58           ` Jason Conroy
2024-04-24 16:23             ` Efraim Flashner
2024-05-06 14:00               ` Jason Conroy
2023-12-14 23:09 ` Csepp
  -- strict thread matches above, loose matches on Subject: below --
2023-05-09  7:32 Efraim Flashner
2023-05-09  8:33 ` Christopher Baines
2023-05-09  8:54   ` Efraim Flashner
2023-05-09  9:27     ` Andreas Enge
2023-05-09  9:28       ` Andreas Enge
2023-05-09 13:22       ` Christopher Baines
2023-05-09 14:04         ` Efraim Flashner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zegx_RGmRAnJ3sHc@3900XT \
    --to=efraim@flashner.co.il \
    --cc=conjaroy@gmail.com \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).