Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aslp-server: separate package and update cohttp #40

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions aslp/asli.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,30 @@

buildDunePackage {
pname = "asli";
version = "cpp-backend-test-unstable-2024-12-27";
version = "offline-package-2025-01-21";

minimalOCamlVersion = "4.09";

src = fetchFromGitHub {
owner = "UQ-PAC";
repo = "aslp";
rev = "dde3c1de0044e812c2badfa53f18b5da929546f4";
hash = "sha256-85y72OMSO6Bw0LcPSryRYnLUYKbNwq3DyQiMX6D3oGs=";
rev = "export-offline-lifter";
hash = "sha256-HmdHfbfrqLRmvS8EjSqgiu/vWF8BEm7E6DS7MecX6Qw=";
};

checkInputs = [ alcotest ];
nativeCheckInputs = [ jdk ];
buildInputs = [ linenoise ppx_blob ];
nativeBuildInputs = [ ott menhir ];
propagatedBuildInputs = [ dune-site z3 pcre pprint zarith ocaml_z3 ocaml_pcre yojson cohttp-lwt-unix mlbdd ];
propagatedBuildInputs = [ z3 pcre pprint zarith ocaml_z3 ocaml_pcre yojson cohttp-lwt-unix mlbdd ];

preConfigure = ''
mkdir -p $out/share/asli
cp -rv prelude.asl mra_tools tests $out/share/asli
'';

postInstall = ''
mv -v $out/bin/asli $out/bin/aslp
cp -v $out/bin/asli $out/bin/aslp
'';

env = {
Expand All @@ -71,12 +71,6 @@ buildDunePackage {
command = "aslp --version";
version = "ASL";
};

tests.aslp-server = testers.testVersion {
package = asli;
command = "command -v aslp-server";
version = "aslp-server";
};
};

meta = {
Expand Down
16 changes: 11 additions & 5 deletions aslp/aslp-cpp.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
{ stdenv
, fetchFromGitHub
, clang17Stdenv
, cmake
, asli
}:

let stdenv' = if stdenv.isDarwin then clang17Stdenv else stdenv;

let
stdenv' = if stdenv.isDarwin then clang17Stdenv else stdenv;
src = fetchFromGitHub {
owner = "UQ-PAC";
repo = "aslp-rpc";
rev = "1a31d940e47246e24fb45cbc5614f24e425566ca";
hash = "sha256-o5+vNRIM0NslWc2NpgPuzdkVFlWmb6lMUGgNQvuNC60=";
};
in stdenv'.mkDerivation {
pname = "aslp-cpp";
version = asli.version;
version = "0.1";

src = "${asli.src}/aslp-cpp";
src = "${src}/aslp-client-http-cpp";

patches = [ ];

Expand Down
58 changes: 58 additions & 0 deletions aslp/aslp-server.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{ lib
, fetchFromGitHub
, buildDunePackage
# pkgs
# ocamlPackages
, eio
, eio_main
, core
, cohttp
, cohttp-eio
# for testing
, aslp
, aslp-server
, testers
}:

buildDunePackage {
pname = "aslp_server_http";
version = "unstable-2025-01-21";

minimalOCamlVersion = "5.0";

src = fetchFromGitHub {
owner = "UQ-PAC";
repo = "aslp-rpc";
rev = "4670a3c94b6dcaf2b0403b655e3f640b355ef578";
hash = "sha256-hIELzXYr6uMWijeBZ6Rhip9JCronn2JLiJJsijzRjco=";
};

checkInputs = [ ];
nativeCheckInputs = [ ];
buildInputs = [ aslp eio eio_main core cohttp cohttp-eio ];
nativeBuildInputs = [ ];
propagatedBuildInputs = [ ];

doCheck = true;

postPatch = ''
substituteInPlace aslp-server-http/bin/dune --replace-warn ' core ' ' '
'';

outputs = [ "out" "dev" ];

passthru = {
tests.aslp-server = testers.testVersion {
package = aslp-server;
command = "command -v aslp-server";
version = "aslp-server";
};
};

meta = {
homepage = "https://github.com/UQ-PAC/aslp-rpc";
description = "RPC connectors for aslp for OCaml and C++ (OCaml HTTP server component)";
maintainers = with lib.maintainers; [ katrinafyi ];
mainProgram = "aslp-server";
};
}
33 changes: 33 additions & 0 deletions aslp/aslp_offline.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{ lib
, fetchFromGitHub
, buildDunePackage
, pcre
, ott
, menhir
, asli
, alcotest
}:

buildDunePackage {
pname = "aslp_offline";
version = asli.version;

minimalOCamlVersion = "4.09";

src = asli.src ;

checkInputs = [ alcotest ];
nativeCheckInputs = [ ];
buildInputs = [ asli ];
nativeBuildInputs = [ asli ];
propagatedBuildInputs = [ ];

doCheck = true;

meta = {
homepage = "https://github.com/UQ-PAC/aslp";
description = "ASL offline lifter generated from ARM's MRA.";
maintainers = with lib.maintainers; [ katrinafyi ];
mainProgram = "offline_sem";
};
}
35 changes: 35 additions & 0 deletions aslp/cohttp-eio.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
buildDunePackage,
cohttp,
eio,
uri,
ppx_sexp_conv,
logs,
sexplib0,
ptime,
}:

buildDunePackage {
pname = "cohttp-eio";
inherit (cohttp)
version
src
;

duneVersion = "3";

buildInputs = [ ppx_sexp_conv ];

propagatedBuildInputs = [
cohttp
eio
logs
sexplib0
uri
ptime
];

meta = cohttp.meta // {
description = "CoHTTP implementation using the Lwt concurrency library";
};
}
24 changes: 24 additions & 0 deletions aslp/cohttp-http.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
buildDunePackage,
cohttp,
}:

buildDunePackage {
pname = "http";
inherit (cohttp)
version
src
;

duneVersion = "3";

buildInputs = [ ];

doCheck = false;

propagatedBuildInputs = [ ];

meta = cohttp.meta // {
description = "Type definitions of HTTP essentials";
};
}
16 changes: 16 additions & 0 deletions aslp/overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,32 @@ final: prev:

inherit (final.ocamlPackages_pac) aslp asli;
inherit (final.ocamlPackages_pac_5) aslp_web;
inherit (final.ocamlPackages_pac_5) aslp-server;
inherit (final.ocamlPackages_pac) aslp_offline;

overlay_ocamlPackages = ofinal: oprev: {
asli = ofinal.callPackage ./asli.nix { inherit (final) z3; ocaml_z3 = ofinal.z3; };
aslp = ofinal.asli;
# .overrideAttrs { src = prev.lib.cleanSource ~/progs/aslp; }
aslp-server = ofinal.callPackage ./aslp-server.nix {};

zarith_stubs_js_0_17 = ofinal.callPackage ./zarith_stubs_js.nix { };
aslp_web = ofinal.callPackage ./aslp_web.nix { zarith_stubs_js = ofinal.zarith_stubs_js_0_17; };

aslp_offline = ofinal.callPackage ./aslp_offline.nix { };

mlbdd = ofinal.callPackage ./mlbdd.nix { };
cohttp = oprev.cohttp.overrideAttrs (p: rec {
version = "6.0.0";
src = final.fetchurl {
url = "https://github.com/mirage/ocaml-cohttp/releases/download/v${version}/cohttp-${version}.tbz";
hash = "sha256-VMw0rxKLNC9K5gimaWUNZmYf/dUDJQ5N6ToaXvHvIqk=";
};
propagatedBuildInputs = p.propagatedBuildInputs ++ [ ofinal.cohttp-http ofinal.logs ];
doCheck = false;
});
cohttp-eio = ofinal.callPackage ./cohttp-eio.nix {};
cohttp-http = ofinal.callPackage ./cohttp-http.nix {};

buildDunePackage = final.makeOverridable ({ pname, version, ... }@args:
let
Expand Down
Loading