Skip to content

Instantly share code, notes, and snippets.

@samoht
samoht / toolchain.md
Last active January 14, 2026 20:29
RFC: Toolchains

RFC: Toolchains

Mental Model

Toolchain = compiler + tools that must match the project's OCaml version.

Dune manages toolchains transparently: download, build, cache, and select the right compiler for each build context.

Toolchain Sources

@samoht
samoht / tools.md
Last active January 14, 2026 20:30
RFC: Developer Tools

RFC: Developer Tools

Mental Model

Dev tool = isolated build + simple cache index.

Tools like ocamlformat, odoc, and ocaml-lsp-server exist alongside your project without polluting its dependency tree.

@samoht
samoht / cache.md
Last active January 14, 2026 20:30
RFC: Unified Package Cache

RFC: Unified Package Cache

Principle

One build flow, one cache, one secondary index.

All packages use the same build flow. The variations are:

  1. Cache key: what identifies a cached build
  2. Context: where the package builds
@samoht
samoht / opam-mode.md
Last active January 14, 2026 20:30
RFC: Opam Build Mode

RFC: Opam Build Mode

Overview

The (mode opam) build mode enables dune to build non-dune packages using their opam build instructions.

Many OCaml packages use ./configure && make, topkg, oasis, or custom scripts. Dune runs these build commands in a sandboxed environment with opam variables expanded.

@samoht
samoht / lock.md
Last active January 14, 2026 20:30
RFC: Lock Files

RFC: Lock Files

Mental Model

Lock file = snapshot of the package universe.

Commit one file (dune.lock), and dune reconstructs your exact dependencies on any machine.

@samoht
samoht / vendor.md
Last active January 14, 2026 20:30
RFC: Extended Vendor Stanza

RFC: Extended Vendor Stanza

Workflow

Copy source code into a directory, add a vendor stanza, run dune build.

my-project/
  src/
  vendor/

Mirage Compilation Process

This document details the details of the compilation process for MirageOS unikernels. It outlines the steps required to prepare, compile, and manage dependencies for Mirage applications.

Overview of the Compilation Process

Developing a simple application with Mirage involves starting with two primary files:

  • config.ml: Contains the configuration of your unikernel.

A distributed, decentralized immutable block store for dune-cache

Objective

The aim of this project is to create a system to store data in the form of immutable, content addressable blocks that can be used as a backend for the dune-cache-daemon.

The envisioned characteristics are:

@samoht
samoht / config.ml
Created March 15, 2020 09:21
MirageOS + dune
open Mirage
let disk = generic_kv_ro "t"
let main = foreign "Unikernel.Main" (kv_ro @-> job)
let () = register ~reporter:Mirage.no_reporter "kv_ro" [ main $ disk ]
@samoht
samoht / digestif.cudf
Created September 3, 2018 11:27
digestif+opam
This file has been truncated, but you can view the full file.
# Solver: builtin-mccs+glpk
# Criteria: -removed,-count[version-lag,request],-count[version-lag,changed],-changed
preamble:
property: opam-query: int = [0], version-lag: nat = [0], pinned: bool = [false], installed-root: bool = [false], reinstall: bool = [false], opam-version: string, opam-name: string
package: fstar
version: 3
depends: ocaml >= 34 , ocamlfind , batteries , ocamlbuild , num
conflicts: fstar
version-lag: 5