-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
50 lines (50 loc) · 1.58 KB
/
flake.nix
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
{
inputs = {
opam-nix.url = "github:tweag/opam-nix";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.follows = "opam-nix/nixpkgs";
};
outputs = { self, flake-utils, opam-nix, nixpkgs }@inputs:
let
package = "tapl";
makeLegacyPackages = system: isDev:
let
pkgs = nixpkgs.legacyPackages.${system};
on = opam-nix.lib.${system};
query =
if isDev
then {
# dev tools must be relayed here to ensure they are built with
# the same compiler version and dependencies
merlin = null;
ocaml-lsp-server = null;
}
else { };
scope = on.buildDuneProject { } package ./. query;
overlay = self: super:
{
# Your overrides go here
};
in
scope.overrideScope' overlay;
in
flake-utils.lib.eachDefaultSystem (system: {
legacyPackages = makeLegacyPackages system false;
defaultPackage = self.legacyPackages.${system}.${package};
devShell =
let
pkgs = nixpkgs.legacyPackages.${system};
legacyPackages = makeLegacyPackages system true;
in
pkgs.mkShell {
# Derived from: https://github.com/tweag/opam-nix/issues/1
nativeBuildInputs = (legacyPackages.nativeBuildInputs or [ ]) ++ [
# dev tools
pkgs.ocamlformat
legacyPackages.merlin
legacyPackages.ocaml-lsp-server
];
inputsFrom = [ legacyPackages.${package} ];
};
});
}