forked from nix-ocaml/nix-overlays
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
57 lines (51 loc) · 1.81 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
{
description = "ocaml-packages-overlay";
nixConfig = {
extra-substituters = "https://anmonteiro.nix-cache.workers.dev";
extra-trusted-public-keys = "ocaml.nix-cache.com-1:/xI2h2+56rwFfKyyFVbkJSeGqSIYMC/Je+7XXqGKDIY=";
};
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?rev=f67841950fe8e33ae6597cc2dac1bc179c3c2627";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
let
overlay = import ./overlay nixpkgs;
in
nixpkgs.lib.recursiveUpdate
{
lib = nixpkgs.lib;
hydraJobs = builtins.listToAttrs (map
(system: {
name = system;
value = import ./ci/hydra.nix {
inherit system;
pkgs = self.legacyPackages.${system};
};
})
[ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ]);
makePkgs = { system, extraOverlays ? [ ], ... }@attrs:
let
pkgs = import nixpkgs ({
inherit system;
overlays = [ overlay ];
config = {
allowUnfree = true;
} // nixpkgs.lib.optionalAttrs (system == "x86_64-darwin") {
config.replaceStdenv = { pkgs, ... }: pkgs.clang11Stdenv;
};
} // attrs);
in
/*
You might read
https://nixos.org/manual/nixpkgs/stable/#sec-overlays-argument and
want to change this but because of how we're doing overlays we will
be overriding any extraOverlays if we don't use `appendOverlays`
*/
pkgs.appendOverlays extraOverlays;
overlays.default = final: prev: overlay final prev;
}
(flake-utils.lib.eachDefaultSystem (system: {
legacyPackages = self.makePkgs { inherit system; };
}));
}