Skip to main content
CLI Tool

apkg

Argo Package Manager

Dual-mode Gentoo + Nix package management with Build Swarm integration

v0.5.2 Current Version
1,208 Lines of Python
114 Automated Tests
70+ Package Mappings
100% Test Pass Rate

Quick Start

Terminal
$ apkg install firefox # Install a package (auto-routes to Nix or Gentoo)
$ apkg search vim # Search for packages
$ apkg update # Sync and update system
$ apkg which firefox # Show routing decision
$ apkg remove package # Uninstall a package

Why apkg?

Traditional Gentoo

emerge --ask --verbose --update --deep --newuse @world
  • Long, hard to remember commands
  • Compiles everything from source
  • Hours/days of compilation time
  • Complex USE flag management

With apkg

apkg upgrade
  • Simple, intuitive commands
  • Uses binary packages from Build Swarm
  • Updates in minutes, not hours
  • Automatic binhost configuration
  • Smart Gentoo/Nix routing for every package

Architecture

apkg acts as a decision engine that routes each package to the optimal backend based on its classification.

apkg CLI
User-facing commands: install, remove, search, update
Decision Engine
70+ package mappings, smart classification rules
Gentoo Backend
emerge / binhost
kernel drivers glibc openrc mesa
Nix Backend
nix-env / home-manager
firefox vscode discord spotify slack

Nix Integration

Starting with v0.5.0, apkg operates in dual-mode: system packages go to Gentoo, userland applications route to Nix. The best of both worlds.

Smart Classification

Every package is classified into one of two categories based on 70+ pre-configured mappings and heuristic rules:

System Packages → Gentoo

  • Kernel and modules
  • GPU drivers (nvidia, mesa)
  • System libraries (glibc, openssl)
  • Init system (OpenRC)
  • Bootloader (GRUB)
  • Low-level toolchain (gcc, binutils)

Userland Apps → Nix

  • Web browsers (Firefox, Chromium)
  • Editors (VS Code, Neovim)
  • Communication (Discord, Slack)
  • Media (Spotify, VLC, OBS)
  • Dev tools (Node.js, Go, Rust tools)
  • CLI utilities (ripgrep, fd, bat)

Override Controls

Force a package to a specific backend when you know better than the heuristics:

apkg install --nix firefox # Force Nix backend
apkg install --gentoo firefox # Force Gentoo/emerge

Persistent overrides can be set in the config file with NIX_FORCE_GENTOO and NIX_FORCE_NIX variables.

Nix Backend Modes

apkg supports two Nix management strategies:

nix-env Imperative package management. Quick installs, familiar workflow.
home-manager Declarative configuration. Reproducible user environments across machines.
apkg which
$ apkg which firefox
Package: firefox
Route: Nix (userland app)
Nix attr: nixpkgs.firefox
Backend: nix-env
$ apkg which mesa
Package: mesa
Route: Gentoo (system library / GPU driver)
Portage: media-libs/mesa
Backend: binhost

Terminal Output Examples

apkg produces educational, color-coded output that explains what is happening under the hood.

apkg install firefox
$ apkg install firefox
[apkg] Install: firefox
Route decision: Nix (userland app - browser)
Mapped: firefox → nixpkgs.firefox
Executing: nix-env -iA nixpkgs.firefox
installing 'firefox-125.0.2'
building '/nix/store/...-user-environment.drv'...
Installed firefox (via Nix) in 34s
apkg status
$ apkg status
[apkg] System Status Dashboard
Gentoo Backend
Mode: binhost
Binhost: 10.42.0.194:8080 [online]
Installed: 847 packages
Updates: 12 available
Nix Backend
Mode: nix-env
Channel: nixpkgs-unstable
Installed: 23 packages
Updates: 4 available
System Health
Disk: 42% used (186G / 440G)
Portage sync: 2 hours ago
Nix channel: 3 hours ago
apkg doctor
$ apkg doctor
[apkg] Health Check
[PASS] Portage tree accessible
[PASS] Binhost reachable (10.42.0.194:8080)
[PASS] Nix daemon running
[PASS] Nix channel configured
[PASS] No broken library links detected
[WARN] 12 Gentoo updates pending
[WARN] 4 Nix updates pending
[PASS] No orphaned packages
[PASS] Package mapping database intact (73 entries)
7 passed, 2 warnings, 0 failures

Features

🚀

Binary Package First

Automatically fetches pre-compiled packages from the Build Swarm binhost when available.

🔍

Smart Search

Fuzzy search across package names and descriptions with highlighted results.

📊

Status Dashboard

View installed packages, pending updates, and system health at a glance.

🔧

USE Flag Helper

Interactive USE flag selection with descriptions and dependency info.

📦

Swarm Integration

Request builds from the Build Swarm if a package isn't in the binhost yet.

🎨

Beautiful Output

Color-coded, human-readable output with progress bars and status indicators.

🔀

Dual-Mode Routing

Smart decision engine routes each package to Gentoo or Nix based on 70+ mappings.

🩺

Health Checks

Built-in doctor command validates binhost, Nix daemon, portage tree, and library links.

Build Swarm Integration

apkg is the client-side interface to the Argo OS Build Swarm. Here is how packages flow from compilation to your machine.

Build Swarm Compiles

66 cores across 5 drones compile packages in parallel with your USE flags

Binhost Hosts

Binary packages stored on the binhost, ready for instant download

apkg Fetches

apkg pulls binaries instead of compiling locally. Zero CPU burn.

30-Second Installs

What took 45 minutes from source now takes half a minute from binary

Command Reference

Command Description Equivalent emerge
apkg install <pkg> Install a package (auto-routes to Gentoo or Nix) emerge --ask pkg
apkg remove <pkg> Uninstall a package emerge --ask --depclean pkg
apkg search <term> Search for packages emerge --search term
apkg update Sync repos & show updates emerge --sync && emerge -pvuDN @world
apkg upgrade Apply all updates emerge -uDN @world
apkg info <pkg> Show package details equery meta pkg
apkg clean Remove orphan packages emerge --depclean
apkg status System status dashboard No equivalent
apkg doctor Pre-update health checks No equivalent
apkg which <pkg> Shows routing decision (Gentoo vs Nix) No equivalent
apkg binhost <addr> Quick binhost switcher Manual make.conf edit
apkg sync --both Sync portage + nix channels emerge --sync

Configuration Reference

apkg is configured via /etc/apkg/apkg.conf or environment variables. All settings have sensible defaults.

Variable Values Default Description
APKG_MODE binhost, standard, auto auto Package fetch strategy. auto tries binhost first, falls back to source.
BINHOST_ADDRESS IP or hostname 10.42.0.194:8080 Address of the Build Swarm binhost server.
NIX_USERLAND disabled, nix-env, home-manager, auto auto Nix backend mode. auto detects home-manager, falls back to nix-env.
NIX_FORCE_GENTOO Comma-separated package list empty Always route these packages to Gentoo, overriding classification.
NIX_FORCE_NIX Comma-separated package list empty Always route these packages to Nix, overriding classification.
/etc/apkg/apkg.conf
# apkg configuration
APKG_MODE=auto
BINHOST_ADDRESS=10.42.0.194:8080
NIX_USERLAND=auto
NIX_FORCE_GENTOO=mesa,nvidia-drivers,pulseaudio
NIX_FORCE_NIX=neovim,tmux

Installation

1

Clone the repository

git clone https://github.com/KeyArgo/apkg.git
2

Run the installer

cd apkg && sudo ./install.sh
3

Configure binhost (optional)

apkg config --binhost http://binhost.local:8080
4

Enable Nix integration (optional)

apkg config --nix auto
5

Verify setup

apkg doctor

Related