Files
homelab/infrastructure/graduated/distoolbox/distoolbox.md

5.0 KiB

Distoolbox

Distrobox? Toolbox? Whatever you want.

# Create and use an Arch Toolbox
toolbox create --distro arch
toolbox enter arch-toolbox-latest

I'd recommend adding this alias to your .bashrc to make things easier

# Toolbox quick enter
alias tbox='SHELL=zsh toolbox enter arch-toolbox-latest'

Reese's Arch Distoolbox

I have a custom arch image based on the default arch-toolbox image. It offers:

  • zsh with many completions installed/enabled
  • vim
  • nslookup
  • iperf3
  • kubectl
  • helm
  • nethogs
  • python, pip, and pipx
  • ansible
  • aws cli
  • podman (connected automatically to the host machine via the unix socket)
  • tmux
  • ffmpeg
  • wine
  • podman
  • unzip
  • bat
  • btop
  • jq
  • yq
  • imagemagick
  • code
  • make, gcc

Using Reese's Arch Toolbox

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

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.

CPU Image with Distrobox

Add the following to your .bashrc

# Reese's Toolbox Commands
export TBOX_REPO='gitea.reeseapps.com/services'
export TBOX_IMAGE='arch-toolbox'
export TBOX_TAG='latest'
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"

AMD GPU Image with Distrobox

This was built and tested for a Framework 16 with GPU module.

Add the following to your .bashrc

# Reese's Toolbox Commands
export TBOX_REPO='gitea.reeseapps.com/services'
export TBOX_IMAGE='arch-toolbox-amdgpu'
export TBOX_TAG='latest'
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 -- /bin/zsh"
# Removes the toolbox
alias rtbox="distrobox stop $TBOX_NAME --yes"

CPU Image with Toolbox

# Reese's Toolbox Commands
export TBOX_REPO='gitea.reeseapps.com/services'
export TBOX_IMAGE='arch-toolbox'
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"

AMD GPU Image with Toolbox

This was built and tested for a Framework 16 with GPU module.

Add the following to your .bashrc

# Reese's Toolbox Commands
export TBOX_REPO='gitea.reeseapps.com/services'
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 wit this (See Containerfile in this directory):

# Build latest image
podman build \
    --no-cache \
    -t gitea.reeseapps.com/services/arch-toolbox:latest \
    -f ./infrastructure/graduated/fedora/Containerfile

# Test with podman
podman run -it --rm gitea.reeseapps.com/services/arch-toolbox:latest

In vscode you can set this as your default build task for homelab and trigger it with ctrl shift B

.vscode/tasks.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": "./infrastructure/graduated/fedora/arch-build.sh",
            "problemMatcher": [],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}