Files
dotfiles/dot_config/private_fish/functions/dev.fish
T
2026-09-14 07:49:16 +02:00

84 lines
1.9 KiB
Fish

function dev
set -l name dev
set -l image fedora:44
set -l packages \
git \
gcc \
gcc-c++ \
make \
pkg-config \
openssl-devel \
clang \
llvm \
cmake \
lld \
gdb \
strace \
curl \
which \
file \
jq \
zoxide \
fzf \
eza \
ripgrep \
du-dust \
tldr \
cheat \
pv \
age
if distrobox list --no-color | string match -q "*| $name *"
distrobox enter $name
return
end
echo "Creating Distrobox container '$name'..."
set -l init_hook '
set -e
echo "Initializing development environment..."
sudo mkdir -p /opt/rustup /opt/cargo
sudo chown -R $USER:$USER /opt/rustup /opt/cargo
sudo mkdir -p /etc/fish/conf.d /etc/fish/completions
printf "%s\n" \
"set -gx RUSTUP_HOME /opt/rustup" \
"set -gx CARGO_HOME /opt/cargo" \
"fish_add_path \$CARGO_HOME/bin /home/user/.local/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
/opt/cargo/bin/rustup default stable
/opt/cargo/bin/rustup completions fish \
| sudo tee /etc/fish/completions/rustup.fish >/dev/null
echo "Development environment initialized successfully."
'
distrobox create \
--name $name \
--image $image --yes \
--additional-packages (string join ' ' $packages) \
--init-hooks "$init_hook"
if test $status -ne 0
echo "Failed to create container '$name'." >&2
return 1
end
distrobox enter $name
end