fish dev function 2

This commit is contained in:
2026-09-14 07:49:16 +02:00
parent 083f8dd16c
commit 07b3bfefad
+43 -27
View File
@@ -2,7 +2,6 @@ function dev
set -l name dev
set -l image fedora:44
# Packages for a general-purpose development environment.
set -l packages \
git \
gcc \
@@ -19,7 +18,16 @@ function dev
curl \
which \
file \
jq
jq \
zoxide \
fzf \
eza \
ripgrep \
du-dust \
tldr \
cheat \
pv \
age
if distrobox list --no-color | string match -q "*| $name *"
distrobox enter $name
@@ -28,35 +36,43 @@ function dev
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 '
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
'
--init-hooks "$init_hook"
if test $status -ne 0
echo "Failed to create container '$name'." >&2