-
Notifications
You must be signed in to change notification settings - Fork 86
/
flake.nix
112 lines (106 loc) · 3.57 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
nixConfig = {
extra-substituters = [
"https://cache.iog.io"
];
extra-trusted-public-keys = [
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
];
allow-import-from-derivation = true;
};
inputs = {
haskellNix = {
url = "github:input-output-hk/haskell.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.hackage.follows = "hackageNix";
};
hackageNix = {
url = "github:input-output-hk/hackage.nix";
flake = false;
};
nixpkgs.follows = "haskellNix/nixpkgs-unstable";
iohkNix.url = "github:input-output-hk/iohk-nix";
flake-utils.url = "github:hamishmack/flake-utils/hkm/nested-hydraJobs";
CHaP.url = "github:intersectmbo/cardano-haskell-packages?ref=repo";
CHaP.flake = false;
};
outputs = inputs:
let # all platforms on which we build
supportedSystems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
in
inputs.flake-utils.lib.eachSystem supportedSystems (
system:
let
# setup our nixpkgs with the haskell.nix overlays, and the iohk-nix
# overlays...
pkgs = import inputs.nixpkgs {
inherit system;
inherit (inputs.haskellNix) config;
overlays = [
# haskellNix.overlay can be configured by later overlays, so need to come before them.
inputs.haskellNix.overlay
(import ./nix/tools.nix inputs)
(import ./nix/ouroboros-network.nix inputs)
(import ./nix/network-docs.nix inputs)
];
};
flake = pkgs.ouroboros-network.flake { };
format = pkgs.callPackage ./nix/formatting.nix pkgs;
inherit (pkgs) lib network-docs;
# shells accessible through `nix develop`,
# `nix develop .\#devShells.x86_64-linux.ghc810`, etc.
devShells = rec {
default = import ./nix/shell.nix {
hls = true;
profiling = false;
inherit inputs pkgs;
ouroboros-network = pkgs.ouroboros-network;
};
profiling = import ./nix/shell.nix {
hls = true;
profiling = true;
inherit inputs pkgs;
ouroboros-network = pkgs.ouroboros-network;
};
};
# jobs executed on hydra
hydraJobs =
pkgs.callPackages inputs.iohkNix.utils.ciJobsAggregates
{
ciJobs =
flake.hydraJobs
// {
# This ensure hydra send a status for the required job (even
# if no change other than commit hash)
revision = pkgs.writeText "revision" (inputs.self.rev or "dirty");
}
// lib.optionalAttrs (system == "x86_64-linux") {
devShell = devShells.default;
inherit format network-docs;
};
};
# Provide hydraJobs through legacyPackages to allow building without system prefix, e.g.
# `nix build .\#network-mux:lib:network-mux`
# `nix build .\#network-docs`
legacyPackages = {
inherit hydraJobs network-docs;
format = format
// {
all = pkgs.releaseTools.aggregate {
name = "network-format";
meta.description = "Run all formatters";
constituents = lib.collect lib.isDerivation format;
};
};
};
in
lib.recursiveUpdate flake rec {
project = pkgs.ouroboros-network;
inherit hydraJobs legacyPackages devShells;
}
);
}