68 lines
1.7 KiB
Fish
68 lines
1.7 KiB
Fish
function dev
|
|
set -l name dev
|
|
set -l image fedora:44
|
|
|
|
# Packages for a general-purpose development environment.
|
|
set -l packages \
|
|
git \
|
|
gcc \
|
|
gcc-c++ \
|
|
make \
|
|
pkg-config \
|
|
openssl-devel \
|
|
clang \
|
|
llvm \
|
|
cmake \
|
|
lld \
|
|
gdb \
|
|
strace \
|
|
curl \
|
|
which \
|
|
file \
|
|
jq
|
|
|
|
if distrobox list --no-color | string match -q "*| $name *"
|
|
distrobox enter $name
|
|
return
|
|
end
|
|
|
|
echo "Creating Distrobox container '$name'..."
|
|
|
|
distrobox create \
|
|
--name $name \
|
|
--image $image --yes \
|
|
--additional-packages (string join ' ' $packages) \
|
|
--init-hooks '
|
|
sudo mkdir -p /opt/rustup /opt/cargo
|
|
sudo chown -R $USER:$USER /opt/rustup /opt/cargo
|
|
|
|
sudo mkdir -p /etc/fish/conf.d
|
|
|
|
printf "%s\n" \
|
|
"set -gx RUSTUP_HOME /opt/rustup" \
|
|
"set -gx CARGO_HOME /opt/cargo" \
|
|
"fish_add_path \$CARGO_HOME/bin" \
|
|
| sudo tee /etc/fish/conf.d/rust.fish >/dev/null
|
|
|
|
export RUSTUP_HOME=/opt/rustup
|
|
export CARGO_HOME=/opt/cargo
|
|
|
|
curl --proto "=https" \
|
|
--tlsv1.2 \
|
|
-sSf https://sh.rustup.rs \
|
|
| sh -s -- -y --no-modify-path
|
|
|
|
# Install rustup Fish completion system-wide.
|
|
mkdir -p /etc/fish/completions
|
|
/opt/cargo/bin/rustup completions fish \
|
|
| sudo tee /etc/fish/completions/rustup.fish >/dev/null
|
|
'
|
|
|
|
if test $status -ne 0
|
|
echo "Failed to create container '$name'." >&2
|
|
return 1
|
|
end
|
|
|
|
distrobox enter $name
|
|
end
|