package opam-repomin

  1. Overview
  2. Docs

opam-repomin

Minimize opam repository overlays using the 0install solver.

Overview

opam-repomin takes an opam repository overlay directory and a full opam-repository, uses the opam-0install solver to determine the minimum set of packages required to make the overlay standalone, and copies the relevant packages to an output directory.

Installation

opam install opam-repomin

Usage

opam-repomin --overlay <overlay-repo> --full <full-repo> --compiler <pkg.version> --output <output-dir>

Options

  • --overlay - Path to the opam repository overlay directory
  • --full - Path to the full opam-repository
  • --compiler - Compiler package to use (e.g., ocaml-base-compiler.5.2.0 or ocaml-variants.5.2.0+options)
  • --output - Output directory for the minimized repository
  • --dry-run - Print what would be copied without actually copying

Example

# Minimize an overlay using OCaml 5.2.0
opam-repomin \
  --overlay ./my-overlay \
  --full ~/.opam/repo/default \
  --compiler ocaml-base-compiler.5.2.0 \
  --output ./minimized-repo

How It Works

  1. Loads all packages from the overlay repository
  2. Loads the full opam-repository
  3. Uses the opam-0install solver to find the minimal set of dependencies needed to install all overlay packages with the specified compiler
  4. Copies only the required package versions from the full repository to the output directory (skipping packages already in the overlay)

License

ISC License. See LICENSE.md.