Skip to content

Commit fcf8ac6

Browse files
committed
add library as an overlay
1 parent f6d09d7 commit fcf8ac6

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

flake.nix

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
outputs = { self, nixpkgs, flake-utils, ocaml-overlay, nix-filter }:
1313
let
14+
supported_ocaml_versions = [ "ocamlPackages_4_12" "ocamlPackages_4_13" "ocamlPackages_5_00" ];
1415
out = system:
1516
let
1617
pkgs = import nixpkgs {
@@ -39,11 +40,9 @@
3940
});
4041

4142
defaultPackage = myPkgs.camlboy;
42-
43-
defaultApp =
44-
flake-utils.lib.mkApp { drv = self.defaultPackage."${system}"; };
45-
4643
};
4744
in
48-
with flake-utils.lib; eachSystem defaultSystems out;
45+
with flake-utils.lib; eachSystem defaultSystems out // {
46+
overlays = { default = import ./nix/overlay.nix supported_ocaml_versions nix-filter; };
47+
};
4948
}

nix/overlay.nix

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
supported_ocaml_versions: nix-filter:
2+
3+
final: prev: {
4+
ocaml-ng = builtins.mapAttrs (name: ocamlVersion:
5+
# If the current ocamlVersion exists in supported versions
6+
(if (builtins.any (x: x == name) supported_ocaml_versions) then
7+
ocamlVersion.overrideScope' (oself: osuper: {
8+
camlboy = (final.callPackage ./camlboy.nix {
9+
inherit nix-filter;
10+
ocamlPackages = oself;
11+
doCheck = true;
12+
});
13+
})
14+
else
15+
ocamlVersion)) prev.ocaml-ng;
16+
}

0 commit comments

Comments
 (0)