Our great sponsors
-
ocaml-flake-example
An overly elaborate example of building a ‘Hello World’ package with Nix flakes, OCaml, and Dune
-
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.
-
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.
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/...
I don't know; that's why I'm asking. Maybe buildOpamPackage already does it? https://github.com/tweag/opam-nix#buildOpamProject
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.
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].
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/
```
Recently also shipped 0.6 with container generation support: https://devenv.sh/containers/
Let me know if you give it a try :)
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.
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)
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.