aboutsummaryrefslogtreecommitdiffstats
path: root/flake.nix
blob: de0506d073efd8f7c1343651bcf6a7d2c461535a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
  description = "RNT — Relations, Not Tables: an experimental database kernel (OCaml library)";

  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

  outputs = { self, nixpkgs }:
    let
      systems = [
        "x86_64-linux"
        "aarch64-linux"
        "x86_64-darwin"
        "aarch64-darwin"
      ];

      forAllSystems = f:
        nixpkgs.lib.genAttrs systems (system:
          f (import nixpkgs { inherit system; }));
    in
    {
      packages = forAllSystems (pkgs:
        let ocamlPackages = pkgs.ocamlPackages; in
        {
          default = ocamlPackages.buildDunePackage {
            pname = "rnt";
            version = "0.1.0";
            duneVersion = "3";
            src = self;

            propagatedBuildInputs = (with pkgs; [
              lmdb
            ]) ++ (with ocamlPackages; [
              batteries
              num
              ctypes
              ctypes-foreign
              sexplib
              digestif
            ]);

            checkInputs = with ocamlPackages; [
              alcotest
              qcheck-core
              qcheck-alcotest
            ];

            doCheck = true;

            meta = {
              description =
                "RNT database kernel inspired by the Windows NT object manager";
              license = pkgs.lib.licenses.agpl3Only;
              maintainers = [ { name = "Marcos Magueta"; } ];
            };
          };
        });

      devShells = forAllSystems (pkgs:
        let
          ocamlPackages = pkgs.ocamlPackages;
          # LFE does not support OTP 28 yet.
          beamPackages = pkgs.beam27Packages;
        in
        {
          default = pkgs.mkShell {
            inputsFrom = [ self.packages.${pkgs.system}.default ];
            packages = (with ocamlPackages; [
              ocaml-lsp
              ocamlformat
              utop
              qcheck-core
              qcheck-alcotest
            ]) ++ [ beamPackages.erlang beamPackages.lfe pkgs.erlang-language-platform ];
            # The karuta subsystem's node runs on erl, which finds LFE here.
            ERL_LIBS = "${beamPackages.lfe}/lib";
          };
        });
    };
}