What are Bundlers?
Bundlers take a Nix derivation (a package built with Nix) and convert it into a format suitable for distribution. This enables you to:- Cross-compile applications for different operating systems and architectures
- Containerize applications as Docker images
- Optimize binary sizes with compression
- Distribute standalone executables without Nix dependencies
Available Bundlers
Nur Nix provides bundlers organized by compilation target:Deno Bundlers
Cross-compile JavaScript/TypeScript apps to standalone binaries for 5 platforms
Go Bundlers
Cross-compile Go applications with optional UPX compression for 6 platforms
Docker Bundlers
Package applications as Docker images with layered or streamed output
System Format
Bundler names use the{system} format to specify target platforms:
| System | Architecture | OS | Example Use |
|---|---|---|---|
x86_64-linux | x86_64 (AMD64) | Linux | Servers, cloud VMs |
aarch64-linux | ARM64 | Linux | Raspberry Pi, ARM servers |
x86_64-darwin | x86_64 (AMD64) | macOS | Intel Macs |
aarch64-darwin | ARM64 | macOS | Apple Silicon Macs |
x86_64-windows | x86_64 (AMD64) | Windows | Desktop/server |
arm-linux | ARM | Linux | Older ARM devices |
The
{system} format ensures consistent cross-platform targeting across all bundlers.Basic Usage
All bundlers are invoked using thenix bundle command:
Command Structure
--bundler- Specifies the bundler to use (from the Nur Nix registry).#myapp- References the derivation to bundle (from your flake)
Bundler Categories
Cross-Compilation Bundlers
Create standalone executables for different platforms:- Deno:
deno-{system}- For JavaScript/TypeScript applications - Go:
go-{system}- For Go applications - Go Compressed:
go-compress-{system}- Go with UPX compression
Container Bundlers
Package applications as Docker images:- docker - Creates a layered Docker image (saved as
.tar.gz) - docker-stream - Streams a layered Docker image (for piping to
docker load)
Practical Example
Here’s how to bundle a Deno application for multiple platforms:Output Location
Bundled artifacts are placed in the Nix store at:Next Steps
Deno Bundlers
JavaScript/TypeScript
Go Bundlers
Go applications
Docker Bundlers
Container images
