Lxc cosmic builder setup - nutthawit/alpine-dotfile GitHub Wiki

Prerequisite

Install and setup the LXC privileged container

Create the container

ct_name=cosmic
lxc-create --name $ct_name --template download -- --dist archlinux --release current --arch amd64

Start the container

lxc-start --name $ct_name --logfile "/tmp/${ct_name}.log" --logpriority debug

Attach to container and set the root password

lxc-attach --name $ct_name

passwd

Now you can login to the container

lxc-console --name $ct_name

Inside the container

Allowed members of wheel group execute privilege commands

visudo

Create normal user

username=tie
useradd -m -G wheel -s /usr/bin/bash $username
passwd $username
su $username

Install a packages required for build

sudo pacman -Syu clang lld make pkgconf just

Install rustc

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Set rustflags to use clang linker

cat << 'EOF' > ~/.cargo/config.toml
rustflags = [
  "-C", "linker=clang",
  "-C", "link-arg=-fuse-ld=lld"
]
EOF

On host

Mount host path to the container

sudo -s
ct_name=cosmic
h_path=/home/tie/wayland-rs
ct_path=home/tie/wayland-rs
echo "lxc.mount.entry = /home/tie/wayland-rs home/tie/wayland-rs none bind,create=dir 0 0" | tee -a "/var/lib/lxc/${ct_name}/config"

Warning

The ct_path must be relative path.

lxc-stop -n $ct_name
lxc-start -n $ct_name
⚠️ **GitHub.com Fallback** ⚠️