Customize your Construct sandbox with user-defined packages via packages.toml.
- Overview
- Package Managers
- Configuration
- Available Packages
- Custom Packages
- Package Installation
- Troubleshooting
Construct supports installing additional packages inside the sandbox environment through packages.toml. This allows you to customize your development environment without rebuilding containers.
Key features:
- Multiple package managers: apt, brew, bun, npm, pip
- Persistent installation: Packages persist across container runs
- Easy updates: Apply new packages with
construct sys packages --install - Custom toolchains: Optional development tools (nix, asdf, mise, vmr, etc.)
| Manager | Description | Usage |
|---|---|---|
| apt | Debian/Ubuntu packages | System libraries, CLI tools |
| brew | Homebrew (macOS/Linux) | Development tools, languages |
| bun | Bun package manager | JavaScript runtime and packages |
| npm | Node Package Manager | Node.js packages and CLIs |
| pip | Python Package Manager | Python packages and modules |
Installation order:
- apt (system packages)
- brew (Homebrew packages)
- bun (JavaScript runtime)
- npm (Node.js packages)
- pip (Python packages)
This order ensures dependencies are installed correctly.
~/.config/construct-cli/packages.toml
# Debian/Ubuntu packages
[apt]
packages = [
"curl",
"git",
"vim",
"htop"
]
# Homebrew packages
[brew]
packages = [
"node",
"python@3.11",
"go"
]
# Bun packages
[bun]
packages = [
"typescript",
"eslint",
"@antfu/solidity"
]
# npm packages
[npm]
packages = [
"typescript",
"prettier",
"eslint"
]
# pip packages
[pip]
packages = [
"requests",
"pytest",
"black"
]Common system packages:
[apt]
packages = [
"build-essential", # C/C++ build tools
"curl", # HTTP client
"git", # Version control
"vim", # Text editor
"htop", # Process monitor
"jq", # JSON processor
"ripgrep", # Fast search tool
"tmux", # Terminal multiplexer
"zsh", # Shell
]Development tools:
[apt]
packages = [
"clang", # C/C++ compiler
"clang-format", # C/C++ formatter
"python3", # Python 3
"python3-pip", # Python package manager
"nodejs", # JavaScript runtime
"openjdk-17-jre", # Java runtime
]Languages and runtimes:
[brew]
packages = [
"node", # Node.js
"python@3.11", # Python 3.11
"go", # Go
"rust", # Rust
"java", # Java
]Development tools:
[brew]
packages = [
"git", # Version control
"gh", # GitHub CLI
"jq", # JSON processor
"yq", # YAML processor
"fd", # Fast file finder
"ripgrep", # Fast content search
"bat", # Better cat
"eza", # Better ls
"delta", # Better git diff
"tldr", # Simplified man pages
]Runtime and packages:
[bun]
packages = [
"typescript", # TypeScript compiler
"eslint", # Linter
"prettier", # Formatter
"@antfu/solidity", # Solidity compiler
]Development tools:
[npm]
packages = [
"typescript",
"prettier",
"eslint",
"@typescript-eslint/eslint-plugin",
]Global CLIs:
[npm]
packages = [
"serverless", # AWS Lambda framework
"tfenv", # Terraform version manager
"knit", # Knative CLI
]Development tools:
[pip]
packages = [
"requests", # HTTP library
"pytest", # Testing framework
"black", # Code formatter
"mypy", # Type checker
"flake8", # Linter
]AWS/cloud tools:
[pip]
packages = [
"boto3", # AWS SDK
"awscli", # AWS CLI
"terraform", # Infrastructure as code
]Simply edit packages.toml:
[apt]
packages = [
"my-custom-tool",
"another-package"
]Then apply changes:
construct sys packages --installapt (system packages):
[apt]
packages = [
"python3.11", # Specific version
"openjdk-17-jre", # Specific version
]brew (versioned packages):
[brew]
packages = [
"python@3.11", # Version 3.11
"node@18", # Node 18.x
"go@1.20", # Go 1.20
]npm (versioned packages):
[npm]
packages = [
"typescript@5.0.0", # Specific version
"eslint@8.0.0", # Specific version
]pip (versioned packages):
[pip]
packages = [
"requests==2.31.0", # Specific version
"pytest==7.4.0", # Specific version
]After editing packages.toml, install packages:
construct sys packages --installThis will:
- Update
packages.tomlin persistent volume - Install packages in running container
- Update containers on next run
Update all packages:
construct sys updateUpdate specific packages:
- Edit version in
packages.toml - Run
construct sys packages --install
To remove packages:
- Edit
packages.toml, remove unwanted packages - Run
construct sys packages --install - Or run
construct sys rebuildfor clean slate
Configure optional development tools:
[tools]
phpbrew = true # PHP version manager
nix = true # Nix package manager
nvm = true # Node version manager
asdf = true # Multi-language version manager
mise = true # Modern asdf alternative
vmr = true # V version managerTool availability:
- Tools must be available in package repositories
- Some tools require additional setup
- Check documentation for each tool
[tools]
phpbrew = false # Disabled
nix = false # Disabled
nvm = true # Enabled
asdf = true # Enabled
mise = false # Disabled
vmr = true # EnabledError: Failed to install package: xyz
Solutions:
-
Check package name is correct
# Search for package apt search python3 brew search node npm search typescript pip search requests -
Check package is available
- Different Linux distributions have different packages
- Some packages may not be available in all repositories
-
Check system compatibility
construct sys doctor
Error: Package version conflicts
Solutions:
-
Specify exact versions
[apt] packages = ["python3.11"] # Specific version
-
Remove conflicting packages
[apt] packages = ["python3.11"] # Remove python3.12 if conflicting
-
Use container rebuild
construct sys rebuild
Error: Packages not persisting
Solutions:
-
Check persistent volume exists
docker volume ls | grep construct -
Rebuild persistent volume
construct sys reset
-
Verify packages.toml is in config
cat ~/.config/construct-cli/packages.toml
1. Keep packages minimal
- Only install what you need
- Avoid unnecessary packages
- Keep sandbox lightweight
2. Use specific versions when needed
- Pin versions for reproducibility
- Document version requirements in project README
3. Test package installation
- Install in fresh container first
- Verify package works as expected
- Document any special setup required
4. Use appropriate package manager
- apt for system packages
- brew for development tools
- npm for Node.js projects
- pip for Python projects
1. Don't install everything
- Avoid installing all available packages
- Keep sandbox focused on your needs
2. Don't mix package managers unnecessarily
- Use npm for Node.js, not apt
- Use pip for Python, not brew
- Avoid version conflicts
3. Don't forget to update packages
- Keep packages updated for security
- Update after changing packages.toml
- Test updates before relying on them
[apt]
packages = [
"curl",
"git",
"build-essential"
]
[brew]
packages = [
"node",
"yarn"
]
[npm]
packages = [
"typescript",
"eslint",
"prettier",
"vite"
][apt]
packages = [
"python3",
"python3-pip",
"python3-venv",
"git"
]
[pip]
packages = [
"requests",
"pytest",
"black",
"mypy",
"flake8",
"boto3"
][apt]
packages = [
"build-essential",
"git",
"curl"
]
[brew]
packages = [
"go",
"gopls",
"gotools"
][apt]
packages = [
"curl",
"git",
"vim",
"jq",
"ripgrep",
"tmux",
"build-essential",
"openjdk-17-jre",
"python3",
"python3-pip",
"nodejs",
"postgresql-client",
"redis-tools",
"mysql-client"
]
[brew]
packages = [
"node",
"go",
"python@3.11",
"terraform",
"gh",
"fd",
"ripgrep",
"bat",
"eza",
"delta"
]
[npm]
packages = [
"typescript",
"eslint",
"prettier",
"serverless",
"aws-cdk"
]
[pip]
packages = [
"requests",
"pytest",
"black",
"boto3",
"terraform"
]- Configuration Guide - Complete config reference
- Installation Guide - Platform-specific setup
- Security Guide - Security best practices
Package issues:
- Check package manager documentation
- Verify package is available for your platform
- Test installation in fresh container
Construct issues:
construct sys doctor # System health check
construct sys config # Edit configurationDocumentation: