Skip to content

9glenda/ocaml-flake

Repository files navigation

ocaml-flake

FlakeHub

Important

This project is work in progress and the api may change.

Simple flake parts module for ocaml inspired by haskell-flake using opam nix.

Getting Started

{
  description = "Ocaml project using `ocaml-flake` and `flake-parts`";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    ocaml-flake.url = "github:9glenda/ocaml-flake";
  };

  outputs = inputs @ {
    flake-parts,
    ocaml-flake,
    ...
  }:
    flake-parts.lib.mkFlake {inherit inputs;} {
      imports = [
        ocaml-flake.flakeModule
      ];
      systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin"];
      perSystem = _: {
        ocaml = {
          duneProjects = {
            default = {
              name = "my_package";
              src = ./.;
            };
          };
        };
      };
    };
}

Thanks to

  • haskell-flake: One of the biggest inspirations for starting this project and designing the interface was the haskell flake. It is a great flake-parts module for haskell and my reccomendation for everyone starting a new haskell project.
  • flake parts: Obviously this project would not been possible without flake-parts. It's a growing ecosystem around designing clean and maintainable flakes.
  • opam-nix: opam-nix is used to build the package internally.