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

chore(nix): switch to flakes and nixpkgs #1041

Merged
merged 1 commit into from
Jun 24, 2024
Merged
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
7 changes: 3 additions & 4 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ jobs:
NIXPKGS_ALLOW_INSECURE: 1
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
submodules: true
- uses: cachix/install-nix-action@v13
- uses: cachix/install-nix-action@V27
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: |
nix-shell --command "dune runtest --profile=dev cohttp cohttp-async cohttp-curl cohttp-curl-async cohttp-curl-lwt cohttp-lwt cohttp-lwt-unix cohttp-mirage cohttp-server-lwt-unix cohttp-top http"
nix-shell --command "dune build --profile=dev cohttp-lwt-jsoo"
nix develop -c dune runtest
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@ clean:
fmt:
dune b @fmt --auto-promote

.PHONY: nix/opam-selection.nix
nix/opam-selection.nix:
nix-shell -A resolve default.nix

eio: #build eio
dune build cohttp-eio

eio-test:
dune runtest cohttp-eio

eio-shell: # nix-shell for eio dev
nix-shell -p gmp libev nmap curl
nix develop .#eio
3 changes: 0 additions & 3 deletions default.nix

This file was deleted.

113 changes: 113 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

138 changes: 138 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
{
description = "Cohttp Nix Flake";

inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:nix-ocaml/nix-overlays";

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = (import nixpkgs {
inherit system;
overlays = [
(final: prev: {
ocamlPackages = prev.ocamlPackages.overrideScope' (oself: osuper: {
ctypes-foreign = osuper.ctypes-foreign.overrideAttrs (_: { doCheck = false; });
ctypes = osuper.ctypes.overrideAttrs (_: { doCheck = false; });
mdx = osuper.mdx.override {
# workaround for:
# https://github.com/NixOS/nixpkgs/pull/241476/commits/1ed74f3536d29e5635d7f47a1d7b82a89f5a8077
logs = oself.logs;
};
});
})
];
});
inherit (pkgs.ocamlPackages) buildDunePackage;
pkg = attrs: buildDunePackage ({
version = "n/a";
src = ./. ;
duneVersion = "3";
doCheck = true;
} // attrs);
ocamlformat = pkgs.ocamlformat_0_26_2;
in
with pkgs.ocamlPackages; rec {
packages = rec {
default = http;
http = pkg {
pname = "http";
checkInputs = [ alcotest base_quickcheck ppx_expect crowbar ];
};
cohttp = pkg {
pname = "cohttp";
checkInputs = [ fmt alcotest ];
propagatedBuildInputs = [
stringext http re uri uri-sexp logs sexplib0 ppx_sexp_conv
];
};
cohttp-top = pkg {
pname = "cohttp-top";
propagatedBuildInputs = [ cohttp ];
};
cohttp-curl = pkg {
pname = "cohttp-curl";
propagatedBuildInputs = [ ocurl http stringext ];
};
cohttp-curl-lwt = pkg {
pname = "cohttp-curl-lwt";
checkInputs = [ cohttp-lwt-unix cohttp cohttp-lwt conduit-lwt ounit uri ];
propagatedBuildInputs = [ ocurl http stringext lwt ];
};
cohttp-curl-async = pkg {
pname = "cohttp-curl-async";
checkInputs = [ uri fmt ounit alcotest cohttp-async ];
propagatedBuildInputs = [
ocurl http stringext cohttp-curl core core_unix
async_kernel async_unix
];
};
cohttp-lwt = pkg {
pname = "cohttp-lwt";
propagatedBuildInputs = [ http cohttp lwt sexplib0 ppx_sexp_conv logs uri ];
};
cohttp-lwt-jsoo = pkg {
pname = "cohttp-lwt-jsoo";
propagatedBuildInputs = [
http cohttp cohttp-lwt logs lwt lwt_ppx js_of_ocaml
js_of_ocaml-ppx js_of_ocaml-lwt
];
};
cohttp-async = pkg {
pname = "cohttp-async";
checkInputs = [ mirage-crypto ounit ];
propagatedBuildInputs = [ http cohttp async_kernel async_unix async base
core core_unix conduit-async magic-mime logs fmt sexplib0 ppx_sexp_conv
uri uri-sexp ipaddr
];
};
cohttp-lwt-unix = pkg {
pname = "cohttp-lwt-unix";
checkInputs = [ ounit ];
propagatedBuildInputs = [
http cohttp cohttp-lwt cmdliner lwt conduit-lwt
conduit-lwt-unix fmt ppx_sexp_conv magic-mime logs
];
};
cohttp-server-lwt-unix = pkg {
pname = "cohttp-server-lwt-unix";
checkInputs = [ conduit-lwt-unix cohttp-lwt cohttp-lwt-unix ];
propagatedBuildInputs = [ http lwt ];
};
cohttp-eio = pkg {
pname = "cohttp-eio";
checkInputs = [ alcotest eio_main mdx ppx_here
tls-eio
mirage-crypto-rng-eio
];
propagatedBuildInputs = [ cohttp eio eio_main logs uri fmt ptime http ];
};
cohttp-mirage = pkg {
pname = "cohttp-mirage";
propagatedBuildInputs = [
mirage-flow mirage-channel conduit conduit-mirage
mirage-kv lwt cohttp-lwt cstruct fmt astring magic-mime ppx_sexp_conv
];
};
cohttp-bench = pkg {
pname = "cohttp-bench";
buildInputs = [
core core_bench eio http cohttp cohttp-eio
cohttp-lwt-unix cohttp-server-lwt-unix cohttp-async
];
};
};
devShells.default = pkgs.mkShell {
inputsFrom = pkgs.lib.attrValues packages;
buildInputs = [ ocamlformat ] ++ (with pkgs.ocamlPackages; [
ocaml-lsp
]);
};
devShells.eio = pkgs.mkShell {
inputsFrom = [ cohttp-eio ];
buildInputs = [ ocamlformat ] ++ (with pkgs; [
ocamlPackages.ocaml-lsp gmp libev nmap curl
]);
};
});
}
50 changes: 0 additions & 50 deletions nix/default.nix

This file was deleted.

Loading
Loading