OxCaml Nix Flake
Find a file
Ivy Fan-Chiang b32261c745
Some checks failed
Build and populate cache / tests (push) Failing after 4m57s
bonsai_flutter, lui, oxcaml-cmdliner2, tgls
2026-11-02 16:34:49 -05:00
.forgejo/workflows workflow: revert switch to native 2026-08-13 23:17:43 -04:00
pkgs bonsai_flutter, lui, oxcaml-cmdliner2, tgls 2026-11-02 16:34:49 -05:00
.gitignore Initial commit 2026-08-01 13:56:13 -04:00
flake.lock oxcaml: switch to 5.2.0-minus40 2026-08-03 20:43:07 -04:00
flake.nix PACKAGES: create 2026-08-15 13:54:25 -04:00
LICENSE license: update 2026-08-01 17:53:48 -04:00
PACKAGES.md bonsai_flutter, lui, oxcaml-cmdliner2, tgls 2026-11-02 16:34:49 -05:00
README.md async_extra, async_shell, bitset, csvfields, hex_encode, 2026-10-27 18:18:11 -04:00

OxCaml Nix Flake

Cachix Cache

Nix flake for the OxCaml compiler and development enviornment.

My attempt at packaging OxCaml, the Jane Street libraries, utop, ocaml-lsp, merlin, and other tools for Nix. Currently builds the 0.18.0-preview.130.106+341 public release version of Jane Street packages and version 5.2.0minus-39 of the OxCaml compiler.

Built derivations will be pushed to a cachix binary cache.

Usage

PACKAGES.md contains a listing of all packages under the legacyPackages.${system}.oxcamlPackages scope.

Utop through nix develop

$ nix develop git+https://git.underpowe.red/hexadecimalDinosaur/oxcaml-nix

$ utop
utop # #require "core";;
utop # open Core;;

Nix Flake devShell

Create a Nix flake in your dev environment based off this template:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    oxcaml-nix.url = "git+https://git.underpowe.red/hexadecimalDinosaur/oxcaml-nix";
  };

  outputs = { nixpkgs, flake-utils, oxcaml-nix, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let pkgs = nixpkgs.legacyPackages.${system}; in
      {
        devShells.default = pkgs.mkShell {
          packages = (with pkgs; [
            # your nixpkgs deps here
          ]) ++ (with oxcaml-nix.legacyPackages.${system}.oxcamlPackages; [
            ocaml
            findlib
            utop
            ocaml-lsp-server
            ocamlformat
            ocp-indent
            merlin
            dot-merlin-reader
            ocaml-index

            base
            ppx_jane
            core
            async
            # any other ocaml deps
          ]);
        };
      }
    );
}

Run nix develop in the folder with your flake or use nix-direnv.

The NixOS wiki page on OCaml describes how to setup your Nix flake to build your project. Remember to source buildDunePackage and your dependencies from oxcaml-nix.legacyPackages.${system}.oxcamlPackages when setting up your package.