- Nix 100%
|
Some checks failed
Build and populate cache / tests (push) Failing after 4m57s
|
||
|---|---|---|
| .forgejo/workflows | ||
| pkgs | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| PACKAGES.md | ||
| README.md | ||
OxCaml Nix Flake
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.