[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to use/install rust nightly on guix ?
From: |
Csepp |
Subject: |
Re: How to use/install rust nightly on guix ? |
Date: |
Mon, 31 Oct 2022 02:05:54 +0100 |
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.
=> 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/
```
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.