Files
homelab/active/software_distoolbox/distoolbox.md
ducoterra ef9104c796
All checks were successful
Reese's Arch Toolbox / build-and-push-arch-toolbox (push) Successful in 14s
moving everything to active or retired vs incubating and graduated
2025-04-19 18:52:33 -04:00

151 lines
4.5 KiB
Markdown

# Distoolbox
Distrobox? Toolbox? Whatever you want.
- [Distoolbox](#distoolbox)
- [Reese's Arch Distoolbox](#reeses-arch-distoolbox)
- [Using Reese's Arch Toolbox](#using-reeses-arch-toolbox)
- [Integrating distoolbox into your workflow](#integrating-distoolbox-into-your-workflow)
- [Aliases using Distrobox](#aliases-using-distrobox)
- [Aliases using Toolbox](#aliases-using-toolbox)
- [Building Reese's Arch Toolbox](#building-reeses-arch-toolbox)
- [Distrobox Notes](#distrobox-notes)
## Reese's Arch Distoolbox
### Using Reese's Arch Toolbox
Head to <https://gitea.reeseapps.com/services/-/packages> and pick the CPU
image or AMD GPU image.
If you can't decide pick the CPU image.
The GPU image was built and tested with a Framework 16 with 7700s GPU module.
Click the image and copy the tag (should be something like:
2a421392b1bde168973a0c7ac8be05a6ffa1c48a)
Next you need [distrobox](https://distrobox.it/) or
[toolbox](https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/).
Both are good options.
If you don't know whether to use distrobox or toolbox:
- If you're on Fedora, and you haven't used either, toolbox is built-in
- If you understand toolbox and you've never used distrobox, try distrobox
- If you understand distrobox and you've never used toolbox, try toolbox
- If you care what I use: distrobox
Once you have toolbox or distrobox installed, try the following:
```bash
export TBOX_REPO='gitea.reeseapps.com/services'
export TBOX_IMAGE='arch-toolbox'
export TBOX_TAG=paste image tag copied above here
export TBOX_NAME="$TBOX_IMAGE-$TBOX_TAG"
# With distrobox
distrobox create --name $TBOX_NAME --image $TBOX_REPO/$TBOX_IMAGE:$TBOX_TAG
distrobox enter $TBOX_NAME
# With toolbox
toolbox create -i $TBOX_REPO/$TBOX_IMAGE:$TBOX_TAG
SHELL=/bin/zsh toolbox enter $TBOX_NAME
```
### Integrating distoolbox into your workflow
Copy the relevant aliases below into your `.bashrc`.
Run `ntbox` the first time to create a new toolbox.
Run `tbox` anytime you want to enter the toolbox.
Run `rtbox` to delete the toolbox.
#### Aliases using Distrobox
Add the following to your `.bashrc`
```bash
# Reese's Toolbox Commands
export TBOX_REPO='gitea.reeseapps.com/services'
# NOTE: Uncomment one of the below for either the amdgpu or cpu image
# export TBOX_IMAGE='arch-toolbox'
# export TBOX_IMAGE='arch-toolbox-amdgpu'
export TBOX_TAG=paste image tag copied above here
export TBOX_NAME="$TBOX_IMAGE-$TBOX_TAG"
# Creates a new toolbox
alias ntbox="distrobox create --name $TBOX_NAME --image $TBOX_REPO/$TBOX_IMAGE:$TBOX_TAG"
# Enters the toolbox when you want to use it, you'll be running this all the time
alias tbox="distrobox enter $TBOX_NAME"
# Removes the toolbox
alias rtbox="distrobox stop $TBOX_NAME --yes && podman container rm $TBOX_NAME"
```
#### Aliases using Toolbox
```bash
# Reese's Toolbox Commands
export TBOX_REPO='gitea.reeseapps.com/services'
# NOTE: Uncomment one of the below for either the amdgpu or cpu image
# export TBOX_IMAGE='arch-toolbox'
# export TBOX_IMAGE='arch-toolbox-amdgpu'
export TBOX_TAG='latest'
export TBOX_NAME="$TBOX_IMAGE-$TBOX_TAG"
# Creates a new toolbox
alias ntbox="toolbox create -i $TBOX_REPO/$TBOX_IMAGE:$TBOX_TAG"
# Enters the toolbox when you want to use it, you'll be running this all the time
alias tbox="SHELL=/bin/zsh toolbox enter $TBOX_NAME"
# Removes the toolbox
alias rtbox="podman container stop $TBOX_NAME && podman container rm $TBOX_NAME"
```
## Building Reese's Arch Toolbox
You can build and run the image with the `arch-build.sh` script (See `Containerfile` in this directory):
```bash
./active/software_distoolbox/arch-build.sh
```
In vscode you can set this as your default build task for homelab and trigger it with
`ctrl shift B`
.vscode/tasks.json
```json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Build arch-toolbox",
"type": "shell",
"command": "./active/software_distoolbox/arch-build.sh",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
```
## Distrobox Notes
<https://github.com/89luca89/distrobox/blob/main/docs/usage/distrobox-create.md>
```bash
# --init creates a separate systemd environment. You won't be able to access the system's host processes.
distrobox create -i docker.io/library/debian --name test-debian
```