Nix-Powered Development with OCaml

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • ocaml-flake-example

    An overly elaborate example of building a ‘Hello World’ package with Nix flakes, OCaml, and Dune

  • If you are mainly using OCaml and do not mind flakes, this was a very good starting point for me: https://github.com/brendanzab/ocaml-flake-example/blob/main/...

  • opam-nix

    Turn opam-based OCaml projects into Nix derivations

  • I don't know; that's why I'm asking. Maybe buildOpamPackage already does it? https://github.com/tweag/opam-nix#buildOpamProject

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • nix-alien

    Run unpatched binaries on Nix/NixOS

  • copy the extracted files over to the nix output dir, and patch-elf all the binaries to link to the nix-version of the dynamic lib.

    This sounds more difficult than it is, the result will be a copied over binary file that has its “libc.so” and other dynamic libs replaced in the ELF-header with “/nix/store/hdjdewuieu737-libc/libc.so”. I recommend looking up a package in nixpkgs which has a similar install story, that’s the easiest way to write a new package.

    In case you only want to run it locally https://github.com/thiagokokada/nix-alien and similar programs work fine with the binary.

  • nixos-apple-silicon

    Resources to install NixOS bare metal on Apple Silicon Macs

  • Most hardcore Nix users/developers I have met have been suspicious for Flakes for several years, so your point rings true.

    That said, it feels like they are slowly coming to terms with it and just accepting it as default. Here are two examples of maintainers eventually accepting flake support on their repos after initial hesitation [1][2].

    [1] https://github.com/tpwrules/nixos-apple-silicon/pull/47

  • mobile-nixos

    Questions? #nixos-aarch64 (or #nixos) on Freenode!

  • lanzaboote

    Secure Boot for NixOS [maintainers=@blitz @raitobezarius @nikstur]

  • Afaik it's not finished yet, but there recently has been quite a lot of activity regarding secureboot for nixos https://github.com/nix-community/lanzaboote/

  • devenv

    Fast, Declarative, Reproducible, and Composable Developer Environments

  • ```

    Recently also shipped 0.6 with container generation support: https://devenv.sh/containers/

    Let me know if you give it a try :)

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • flambda-backend

    The Flambda backend project for OCaml

  • I was hoping this post would mention using OCaml with flambda[1] enabled. At least for my work, flambda seems to yield a ~10% speed up when compiling things. Can you get OCaml binaries with flambda enabled through Nix? With opam, I currently have to compile OCaml myself to enable it, as I am not aware of any binaries being distributed.

    [1] https://github.com/ocaml-flambda/flambda-backend

  • book

    V2 of Real World OCaml (by realworldocaml)

  • I don't think they're wrong

    the Jane Street side are quite prolific with blog posts etc

    as a newcomer to OCaml one of the first, and nicer-looking, intro resources you'll likely encounter is the Real World OCaml book https://dev.realworldocaml.org/ which unfortunately does everything using Base instead of the stdlib

    Personally that didn't sit right to me and I prefer to use the stdlib by default (which seems fine and not in need of a wholesale replacement)

  • nixpkgs

    Nix Packages collection & NixOS

  • The nix option for it was added in 2017:

    https://github.com/NixOS/nixpkgs/pull/32946

    If you find it important, I'd encourage opening a PR to ask for flambda to be enabled by default at https://github.com/NixOS/nixpkgs/issues/new/choose.

    Especially if the ocaml community typically enables flambda by default these days.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts