Skip to content

Commit

Permalink
feat(nix): Add nix support in the 2.5.x branch (OCamlPro#1121)
Browse files Browse the repository at this point in the history
With the right Dolmen version.
  • Loading branch information
bclement-ocp authored May 14, 2024
1 parent 37b2add commit 79736e5
Show file tree
Hide file tree
Showing 10 changed files with 455 additions and 0 deletions.
61 changes: 61 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{ sources ? import ./nix/sources.nix
, pkgs ? import ./nix { inherit sources; }
}:

let
inherit (pkgs) lib ocamlPackages;
version = "dev";
src = lib.cleanSource ./.;
alt-ergo-lib = ocamlPackages.buildDunePackage rec {
pname = "alt-ergo-lib";
inherit version src;

minimalOCamlVersion = "4.08";
duneVersion = "3";

propagatedBuildInputs = with ocamlPackages; [
dune-build-info
zarith
ocplib-simplex
seq
stdlib-shims
fmt
ppx_blob
dolmen_loop
camlzip
ppx_deriving
stdcompat
];
};

alt-ergo-parsers = ocamlPackages.buildDunePackage rec {
pname = "alt-ergo-parsers";
inherit version src;

minimalOCamlVersion = "4.08";
duneVersion = "3";

nativeBuildInputs = [ ocamlPackages.menhir ];
propagatedBuildInputs = [ alt-ergo-lib ] ++ (with ocamlPackages; [
psmt2-frontend
]);
};

alt-ergo = ocamlPackages.buildDunePackage {
pname = "alt-ergo";
inherit version src;

minimalOCamlVersion = "4.08";
duneVersion = "3";

buildInputs = [ alt-ergo-parsers ] ++ (with ocamlPackages; [
cmdliner
dune-site
]);
};

in

{
alt-ergo = alt-ergo;
}
16 changes: 16 additions & 0 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{ sources ? import ./sources.nix }:

import sources.nixpkgs {
overlays = [
(_: pkgs: { inherit sources; })
(_: pkgs: {
ocamlPackages = pkgs.ocamlPackages.overrideScope' (self: super: {
pp_loc = pkgs.callPackage ./pp_loc.nix { };
ocplib-simplex = pkgs.callPackage ./ocplib-simplex.nix { };
dolmen = pkgs.callPackage ./dolmen.nix { };
dolmen_type = pkgs.callPackage ./dolmen_type.nix { };
dolmen_loop = pkgs.callPackage ./dolmen_loop.nix { };
});
})
];
}
23 changes: 23 additions & 0 deletions nix/dolmen.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ sources, lib, ocamlPackages }:

let
dolmen = sources.dolmen;
in

ocamlPackages.buildDunePackage {
strictDeps = true;
pname = "dolmen";
inherit (dolmen) version;

minimalOCamlVersion = "4.08";
duneVersion = "3";

src = dolmen;

nativeBuildInputs = [ ocamlPackages.menhir ];
propagatedBuildInputs = with ocamlPackages; [ hmap menhirLib fmt ];

meta = with lib; {
inherit (dolmen) homepage description;
};
}
13 changes: 13 additions & 0 deletions nix/dolmen_loop.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ sources, lib, ocamlPackages }:

ocamlPackages.buildDunePackage {
pname = "dolmen_loop";
inherit (ocamlPackages.dolmen) version src strictDeps;

minimalOCamlVersion = "4.08";
duneVersion = "3";

propagatedBuildInputs = [ ocamlPackages.gen ocamlPackages.dolmen_type ];

meta = ocamlPackages.dolmen.meta;
}
18 changes: 18 additions & 0 deletions nix/dolmen_type.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ sources, lib, ocamlPackages }:

ocamlPackages.buildDunePackage {
pname = "dolmen_type";
inherit (ocamlPackages.dolmen) version src strictDeps;

minimalOCamlVersion = "4.08";
duneVersion = "3";

propagatedBuildInputs = [
ocamlPackages.dolmen
ocamlPackages.pp_loc
ocamlPackages.spelll
ocamlPackages.uutf
];

meta = ocamlPackages.dolmen.meta;
}
18 changes: 18 additions & 0 deletions nix/ocplib-simplex.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ sources, lib, ocamlPackages }:

ocamlPackages.buildDunePackage {
strictDeps = true;
pname = "ocplib-simplex";
inherit (sources.ocplib-simplex) version;

minimalOCamlVersion = "4.02";
duneVersion = "3";

src = sources.ocplib-simplex;

propagatedBuildInputs = [ ocamlPackages.num ocamlPackages.logs ];

meta = with lib; {
inherit (sources.ocplib-simplex) homepage description;
};
}
13 changes: 13 additions & 0 deletions nix/pp_loc.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ sources, lib, ocamlPackages }:

ocamlPackages.buildDunePackage {
strictDeps = true;
pname = "pp_loc";
inherit (sources.pp_loc) version;

src = sources.pp_loc;

meta = with lib; {
inherit (sources.pp_loc) homepage description;
};
}
53 changes: 53 additions & 0 deletions nix/sources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"dolmen": {
"branch": "v0.9",
"description": "Dolmen provides a library and a binary to parse, typecheck, and evaluate languages used in automated deduction",
"homepage": "",
"owner": "Gbury",
"repo": "dolmen",
"rev": "d9f5abbaffe6e5daa4b06758db66134fe85c8c6a",
"sha256": "1lbygac7pmq8d5pps4idc36ga69vx2fwz9pdpv7j2xiqxgava46y",
"type": "tarball",
"url": "https://github.com/Gbury/dolmen/archive/d9f5abbaffe6e5daa4b06758db66134fe85c8c6a.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz",
"version": "0.9"
},
"nixpkgs": {
"branch": "release-23.11",
"description": "Nix Packages collection",
"homepage": null,
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "544b36d1b4815fd5f187ed00ff7a59fd0323317c",
"sha256": "0jh67yjfkv9sj4xldlv9p6whljg0rh96hy7x082061ghsb3kg6q4",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/544b36d1b4815fd5f187ed00ff7a59fd0323317c.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"ocplib-simplex": {
"branch": "v0.5.1",
"description": "A library implementing a simplex algorithm, in a functional style, for solving systems of linear inequalities",
"homepage": "",
"owner": "OCamlPro",
"repo": "ocplib-simplex",
"rev": "12e7c1fd994d4c40cf7159008a67579f470df616",
"sha256": "0jkyqvcia4950cr1ip4n4xnjgaqlliljw48b40n95j75wjvy3d3w",
"type": "tarball",
"url": "https://github.com/OCamlPro/ocplib-simplex/archive/12e7c1fd994d4c40cf7159008a67579f470df616.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz",
"version": "0.5.1"
},
"pp_loc": {
"branch": "v2.1.0",
"description": "Pretty-printing for error source locations",
"homepage": "https://armael.github.io/pp_loc/pp_loc/",
"owner": "Armael",
"repo": "pp_loc",
"rev": "d8162fd289849ea2f4125054ab88540416bdaa25",
"sha256": "1wf5pqfxbfbjlwg24n3w99xm29qn1xjjjqn2z01vr5wgxcj9nfvd",
"type": "tarball",
"url": "https://github.com/Armael/pp_loc/archive/d8162fd289849ea2f4125054ab88540416bdaa25.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz",
"version": "2.1.0"
}
}
Loading

0 comments on commit 79736e5

Please sign in to comment.