-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
68 lines (66 loc) · 2.11 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{
description = "nix-ci-build flake";
inputs.nixpkgs.url = "github:nix-ocaml/nix-overlays";
inputs.nix-eval-jobs-src.url = "github:nix-community/nix-eval-jobs";
outputs = { self, nixpkgs, nix-eval-jobs-src }:
let
forAllSystems = f: nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed (system:
let
pkgs = nixpkgs.legacyPackages.${system}.extend (self: super: {
ocamlPackages = super.ocaml-ng.ocamlPackages_5_3;
});
in
f pkgs);
in
{
packages = forAllSystems (pkgs:
let
inherit (pkgs) lib system makeWrapper ocamlPackages stdenv;
nix-eval-jobs = nix-eval-jobs-src.outputs.packages.${system}.default;
path = lib.makeBinPath [ nix-eval-jobs ];
# Needed for x86_64-darwin
buildDunePackage =
if stdenv.isDarwin && !stdenv.isAarch64 then
ocamlPackages.buildDunePackage.override
{ stdenv = pkgs.overrideSDK stdenv "11.0"; }
else
ocamlPackages.buildDunePackage;
in
{
default = buildDunePackage {
pname = "nix-ci-build";
version = "n/a";
src = let fs = lib.fileset; in fs.toSource {
root = ./.;
fileset = fs.unions [
./bin
./lib
./dune-project
./nix-ci-build.opam
];
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ nix-eval-jobs ];
propagatedBuildInputs = with ocamlPackages; [
cmdliner
eio_main
logs
fmt
ppx_yojson_conv
];
postInstall = ''
wrapProgram "$out/bin/nix-ci-build" --prefix PATH : ${path}
'';
};
});
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
inputsFrom = [ self.packages.${pkgs.system}.default ];
nativeBuildInputs = with pkgs.ocamlPackages; [
merlin
ocamlformat
];
};
});
};
}