fish dev function 3 with exports working

This commit is contained in:
2026-09-14 09:45:57 +02:00
parent 07b3bfefad
commit 6a8e824941
3 changed files with 128 additions and 34 deletions
@@ -0,0 +1,3 @@
function dev-remove
distrobox rm --force dev
end
+2 -34
View File
@@ -36,48 +36,16 @@ 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 "$init_hook"
--init-hooks 'bash "$HOME/.scripts/distrobox-dev-init.sh"'
if test $status -ne 0
echo "Failed to create container '$name'." >&2
return 1
end
distrobox enter $name
distrobox enter $name --verbose
end