blob: 7cc04fdf8f6b8d8e7d365de1fa7748bc0df03bdd (
plain)
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
51
52
53
54
55
56
57
58
|
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
opam-nix.url = "github:tweag/opam-nix";
opam-repository = {
url = "github:ocaml/opam-repository";
flake = false;
};
opam-nix.inputs.opam-repository.follows = "opam-repository";
opam-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, opam-nix, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
inherit (opam-nix.lib.${system})
buildOpamProject
materializedDefsToScope
materializeOpamProject';
package = "wormhole";
query = {
ocaml-base-compiler = "*";
};
overlay = final: prev: {
"${package}" = prev.${package}.overrideAttrs (_: {
# override derivation attributes, e.g. add additional dependacies
buildInputs = [
pkgs."gmp"
pkgs."libev"
pkgs."openssl"
];
});
};
resolved-scope =
let scope = buildOpamProject { } package ./. query;
in scope.overrideScope' overlay;
materialized-scope =
let scope = materializedDefsToScope
{ sourceMap.${package} = ./.; } ./package-defs.json;
in scope.overrideScope' overlay;
in rec {
packages = {
resolved = resolved-scope;
materialized = materialized-scope;
# to generate:
# cat $(nix eval .#package-defs --raw) > package-defs.json
package-defs = materializeOpamProject' { } ./. query;
};
defaultPackage = packages.materialized.${package};
devShells.default = pkgs.mkShell {
inputsFrom = [ defaultPackage ];
buildInputs = [];
};
}
);
}
|