-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathflake.nix
88 lines (82 loc) · 3.22 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
{
inputs = {
haskellNix.url = "github:input-output-hk/haskell.nix";
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:input-output-hk/cardano-haskell-packages?ref=repo";
CHaP.flake = false;
# non-flake nix compatibility
flake-compat.url = "github:edolstra/flake-compat";
flake-compat.flake = false;
};
outputs = inputs:
let
profiling = false;
supportedSystems = [
"x86_64-linux"
"x86_64-darwin"
# not supported on ci.iog.io right now
#"aarch64-linux"
"aarch64-darwin"
]; in
let flake = inputs.flake-utils.lib.eachSystem supportedSystems (system:
let
# setup our nixpkgs with the haskell.nix overlays, and the iohk-nix
# overlays...
nixpkgs = import inputs.nixpkgs {
overlays = [inputs.haskellNix.overlay] ++ builtins.attrValues inputs.iohkNix.overlays;
inherit system;
inherit (inputs.haskellNix) config;
};
# ... and construct a flake from the cabal.project file.
# We use cabalProject' to ensure we don't build the plan for
# all systems.
perSystemFlake = (nixpkgs.haskell-nix.cabalProject' ({pkgs, lib, config, ...}: {
src = ./.;
name = "cardano-prelude";
compiler-nix-name = "ghc92";
flake = {
variants = {
ghc810.compiler-nix-name = lib.mkForce "ghc810";
ghc96.compiler-nix-name = lib.mkForce "ghc96";
ghc98.compiler-nix-name = lib.mkForce "ghc98";
ghc910.compiler-nix-name = lib.mkForce "ghc910";
};
# we also want cross compilation to windows.
crossPlatforms = p:
lib.optional (system == "x86_64-linux" && builtins.elem config.compiler-nix-name ["ghc8107" "ghc928"]) p.mingwW64;
};
# CHaP input map, so we can find CHaP packages (needs to be more
# recent than the index-state we set!). Can be updated with
#
# nix flake lock --update-input CHaP
#
inputMap = {
"https://input-output-hk.github.io/cardano-haskell-packages" = inputs.CHaP;
};
})).flake {};
in perSystemFlake
); in let pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
# This is not ideal, it means this flake will not evaluate properly on
# anything but linux :-/ However, CI requires a top-level required job,
# for now. And not one per system.
in pkgs.lib.recursiveUpdate flake {
# add a required job, that's basically all hydraJobs.
hydraJobs = pkgs.callPackages inputs.iohkNix.utils.ciJobsAggregates
{ ciJobs = flake.hydraJobs; };
};
nixConfig = {
extra-substituters = [
"https://cache.iog.io"
# drop this, once we stop needing it; when we have stable aarch64-darwin
# builds
"https://cache.zw3rk.com"
];
extra-trusted-public-keys = [
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
"loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk="
];
allow-import-from-derivation = true;
};
}