unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* How to use/install rust nightly on guix ?
@ 2022-10-29 12:29 Mohamed Amine LEGHERABA via
  2022-10-29 12:31 ` (
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mohamed Amine LEGHERABA via @ 2022-10-29 12:29 UTC (permalink / raw)
  To: help-guix@gnu.org

Hello guys,
Any ideas for the best way to install rust nightly on guix ? I don't find it in the guix channel, neither rustup.
I need rust nightly to compile a certain project (this one : https://github.com/paritytech/substrate).

Thanks,
Mohamed Amine LEGHERABA

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to use/install rust nightly on guix ?
  2022-10-29 12:29 How to use/install rust nightly on guix ? Mohamed Amine LEGHERABA via
@ 2022-10-29 12:31 ` (
  2022-10-29 16:13   ` Csepp
  2022-10-29 18:08 ` Sergiu Ivanov
  2022-11-01 10:04 ` phodina
  2 siblings, 1 reply; 7+ messages in thread
From: ( @ 2022-10-29 12:31 UTC (permalink / raw)
  To: Mohamed Amine LEGHERABA, help-guix@gnu.org

On Sat Oct 29, 2022 at 1:29 PM BST, Mohamed Amine LEGHERABA via wrote:
> Hello guys,
> Any ideas for the best way to install rust nightly on guix ? I don't find it in the guix channel, neither rustup.
> I need rust nightly to compile a certain project (this one : https://github.com/paritytech/substrate).

You can't. Rustup doesn't work on Guix/Nix, as it assumes FHS. You'd
have to package rust-nightly, but it'll take ages to build...

    -- (


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to use/install rust nightly on guix ?
  2022-10-29 12:31 ` (
@ 2022-10-29 16:13   ` Csepp
  2022-10-29 20:57     ` Re : " Mohamed Amine LEGHERABA
  0 siblings, 1 reply; 7+ messages in thread
From: Csepp @ 2022-10-29 16:13 UTC (permalink / raw)
  To: (; +Cc: Mohamed Amine LEGHERABA, help-guix


"(" <paren@disroot.org> writes:

> On Sat Oct 29, 2022 at 1:29 PM BST, Mohamed Amine LEGHERABA via wrote:
>> Hello guys,
>> Any ideas for the best way to install rust nightly on guix ? I don't find it in the guix channel, neither rustup.
>> I need rust nightly to compile a certain project (this one : https://github.com/paritytech/substrate).
>
> You can't. Rustup doesn't work on Guix/Nix, as it assumes FHS. You'd
> have to package rust-nightly, but it'll take ages to build...
>
>     -- (

Well, you *might* be able to get it working with an FHS container and
maybe an overlay mount.
What I would personally do is install Arch in a chroot and install
rustup there.  You can even use Guix within the chroot if you bind mount
it.
If you want to try that, I have a more detailed how-to that I can send.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to use/install rust nightly on guix ?
  2022-10-29 12:29 How to use/install rust nightly on guix ? Mohamed Amine LEGHERABA via
  2022-10-29 12:31 ` (
@ 2022-10-29 18:08 ` Sergiu Ivanov
  2022-11-01 10:04 ` phodina
  2 siblings, 0 replies; 7+ messages in thread
From: Sergiu Ivanov @ 2022-10-29 18:08 UTC (permalink / raw)
  To: Mohamed Amine LEGHERABA; +Cc: help-guix

Hi,

Until a couple weeks ago this channel used to work:

https://github.com/paulalesius/guix-rust

but apparently the author abandoned it for now.  Maybe you could reuse
(part of) their work.

-
Sergiu


Mohamed Amine LEGHERABA via <help-guix@gnu.org> [2022-10-29T14:29:26+0200]:
> Hello guys,
> Any ideas for the best way to install rust nightly on guix ? I don't find it in the guix channel, neither rustup.
> I need rust nightly to compile a certain project (this one : https://github.com/paritytech/substrate).
>
> Thanks,
> Mohamed Amine LEGHERABA



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re : Re: How to use/install rust nightly on guix ?
  2022-10-29 16:13   ` Csepp
@ 2022-10-29 20:57     ` Mohamed Amine LEGHERABA
  2022-10-31  1:05       ` Csepp
  0 siblings, 1 reply; 7+ messages in thread
From: Mohamed Amine LEGHERABA @ 2022-10-29 20:57 UTC (permalink / raw)
  To: Csepp; +Cc: (, help-guix

Yes Csepp I'm interested by your tutoriel on how to create a chroot Arch on Guix, It will allow me to run several "exotic" languages/programs on my computer (including rust nigthly).

Thanks,
Mohamed Amine LEGHERABA

------- Original Message -------
Le samedi 29 octobre 2022 à 18:13, Csepp <raingloom@riseup.net> a écrit :


> "(" paren@disroot.org writes:
> 
> > On Sat Oct 29, 2022 at 1:29 PM BST, Mohamed Amine LEGHERABA via wrote:
> > 
> > > Hello guys,
> > > Any ideas for the best way to install rust nightly on guix ? I don't find it in the guix channel, neither rustup.
> > > I need rust nightly to compile a certain project (this one : https://github.com/paritytech/substrate).
> > 
> > You can't. Rustup doesn't work on Guix/Nix, as it assumes FHS. You'd
> > have to package rust-nightly, but it'll take ages to build...
> > 
> > -- (
> 
> 
> Well, you might be able to get it working with an FHS container and
> maybe an overlay mount.
> What I would personally do is install Arch in a chroot and install
> rustup there. You can even use Guix within the chroot if you bind mount
> it.
> If you want to try that, I have a more detailed how-to that I can send.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to use/install rust nightly on guix ?
  2022-10-29 20:57     ` Re : " Mohamed Amine LEGHERABA
@ 2022-10-31  1:05       ` Csepp
  0 siblings, 0 replies; 7+ messages in thread
From: Csepp @ 2022-10-31  1:05 UTC (permalink / raw)
  To: Mohamed Amine LEGHERABA; +Cc: Csepp, (, help-guix

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


Mohamed Amine LEGHERABA <mlegheraba@protonmail.com> writes:

> Yes Csepp I'm interested by your tutoriel on how to create a chroot
> Arch on Guix, It will allow me to run several "exotic"
> languages/programs on my computer (including rust nigthly).
>
> Thanks,
> Mohamed Amine LEGHERABA

Here is the current version.  

[-- Attachment #2: rubber duck debug log --]
[-- Type: text/plain, Size: 2473 bytes --]

=> https://bugs.archlinux.org/task/46169


Download bootstrap chroot
=> http://quantum-mirror.hu/mirrors/pub/archlinux/iso/2021.11.01/archlinux-bootstrap-2021.11.01-x86_64.tar.gz
Extract it somewhere.

Final boot script.
Important!!! Run with `sudo -E`. The "-E" is important. Or just hardcode the path to your home directory.
```
#!/bin/sh
set -ex

cd "$(dirname "$0")"
mount --bind root.x86_64 root.x86_64
mount -o bind "$HOME" root.x86_64/home/user/host-home

# delete these two if you are not using Guix, or modify them if you are using Nix
mount -o bind,ro /gnu/store root.x86_64/gnu/store
mount -o bind,ro /var/guix root.x86_64/var/guix

bash root.x86_64/bin/arch-chroot root.x86_64 /bin/env -i bash -l

# again, delete them
umount -l root.x86_64/var/guix
umount -l root.x86_64/gnu/store

umount -l root.x86_64/home/user/host-home
umount -l root.x86_64
```

First time, on the host system:
```
# write down this number, it will be important
echo $UID

sudo mount --bind root.x86_64 root.x86_64
sudo bash root.x86_64/bin/arch-chroot root.x86_64 /bin/env -i bash -l
```

First time setup inside guest:
```
# enable some mirrors
sed -i 's/^#\(.*\.hu.*\)/\1/' /etc/pacman.d/mirrorlist
# set up timezone
ln -s /usr/share/zoneinfo/Europe/Budapest /etc/localtime
# initalize package manager
pacman-key --init
pacman-key --populate archlinux
# install development packages
pacman -Syu --needed git base-devel
# optional if you are using Guix, otherwise not really:
pacman -S base
# (if you are using Guix or Nix, you can just mount their store and use their packages)
# create store mount point
mkdir -p /gnu/store
mkdir -p /var/guix
# create a non-root user. the UID thing is important, it lets you share your host's home directory in the guest.
useradd -m -u $UID_OF_HOST_USER user
# optional: ignore all security precautions and enable passwordless sudo for this user?
# maybe don't do this?
echo 'user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
# alternatively, add a password
usermod -aG wheel user
passwd user
echo "%wheel ALL=(ALL:ALL) ALL" >> /etc/sudoers
# change to a login shell of the new user
su -l user
# create host home mount
mkdir ~/host-home
# install yay
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

# now you can install anything, like, say, Infer.
yay -Sy infer

# link to host guix. ignore if your host system isn't Guix.
(cd ~/.config; ln -s ../host-home/.config/guix ~/.config/guix)
ln -s host-home/.guix-profile ~/.guix-profile/
```

[-- Attachment #3: Type: text/plain, Size: 309 bytes --]


I wrote it in a way that is hopefully usable to others, but it's still
not exactly a polished how-to guide, so if you have any questions, feel
free to ask them.
There are a bunch of gotchas that I probably forgot to mention, like how
having Guix's environment variables active can mess with Arch's
upgrades.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: How to use/install rust nightly on guix ?
  2022-10-29 12:29 How to use/install rust nightly on guix ? Mohamed Amine LEGHERABA via
  2022-10-29 12:31 ` (
  2022-10-29 18:08 ` Sergiu Ivanov
@ 2022-11-01 10:04 ` phodina
  2 siblings, 0 replies; 7+ messages in thread
From: phodina @ 2022-11-01 10:04 UTC (permalink / raw)
  To: Mohamed Amine LEGHERABA; +Cc: help-guix, raingloom

Hi,

> Hello guys,
> Any ideas for the best way to install rust nightly on guix ? I don't find it in the guix channel, neither rustup.
> I need rust nightly to compile a certain project (this one : https://github.com/paritytech/substrate).
> 
> Thanks,
> Mohamed Amine LEGHERABA

Not sure it's what you asked but my workflow with Rust is to create/clone Rust package. Then create Guix package with source pointing to that directory and adding all the build dependencies (plus all other fields package should have).
The last part is to enable the RUSTC_BOOTSTRAP=1 environment variable in the arguments after unpack phase. [1]

> The build system sets RUSTC_BOOTSTRAP=1. This special variable means to break the stability guarantees of rust: Allow using #![feature(...)] with a compiler that's not nightly. This should never be used except when bootstrapping the compiler.

It's a hack that works for now but haven't found a better way yet.

Last step is to run:
guix shell -D PKG

This gives you environment to test the build locally.

----
Petr


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-11-01 10:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-29 12:29 How to use/install rust nightly on guix ? Mohamed Amine LEGHERABA via
2022-10-29 12:31 ` (
2022-10-29 16:13   ` Csepp
2022-10-29 20:57     ` Re : " Mohamed Amine LEGHERABA
2022-10-31  1:05       ` Csepp
2022-10-29 18:08 ` Sergiu Ivanov
2022-11-01 10:04 ` phodina

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).