This repository has been archived by the owner on Jun 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
/
default.nix
102 lines (95 loc) · 3.55 KB
/
default.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
let
commonLib = import ./lib.nix;
in
{ system ? builtins.currentSystem
, crossSystem ? null
, config ? {}
, pkgs ? (import (commonLib.nixpkgs) { inherit system crossSystem config; })
, compiler ? pkgs.haskellPackages
, cardanoRevOverride ? null
, cardanoNodeRevOverride ? null
, ...
}@args:
with pkgs.lib;
with pkgs.haskell.lib;
let
# nixopsUnstable = /path/to/local/src
sources = commonLib.sources;
nixopsPacketSrc = sources.nixops-packet;
nixopsSrc = sources.nixops-core; # nixops is an input to iohk-ops on hydra so different name
haskellOverlay = hself: hsuper: {
amazonka-core = pkgs.haskell.lib.appendPatch hsuper.amazonka-core ./iohk/amazonka-content-length.patch;
};
haskellPackages = pkgs.haskellPackages.override (old: {
overrides = composeExtensions (old.overrides or (_: _: {})) haskellOverlay;
});
log-classifier-web = (import log-classifier-src {}).haskellPackages.log-classifier-web;
nixops =
let
in (import "${nixopsSrc}/release.nix" {
inherit (commonLib) nixpkgs;
p = (p: let
nixopsPacket = p.callPackage "${nixopsPacketSrc}/release.nix" {};
in [ p.aws nixopsPacket ]);
}).build.${system};
log-classifier-src = sources.log-classifier;
iohk-ops-extra-runtime-deps = with pkgs; [
gitFull nix-prefetch-scripts (pkgs.haskell.lib.justStaticExecutables compiler.yaml)
wget
file
nixops
coreutils
gnupg
];
cardano-sl-src = sources.cardano-sl.revOverride cardanoRevOverride;
cardano-sl-pkgs = import cardano-sl-src {
gitrev = cardano-sl-src.rev;
};
mantis-pkgs = commonLib.fetchProjectPackages "mantis" <mantis> ./goguen/pins mantisRevOverride args;
cardano-node-pkgs = import (sources.cardano-node.revOverride cardanoNodeRevOverride) {};
iohk-ops = pkgs.haskell.lib.justStaticExecutables
(pkgs.haskell.lib.overrideCabal
(haskellPackages.callPackage ./iohk {})
(drv: {
executableToolDepends = [ pkgs.makeWrapper ];
libraryHaskellDepends = (drv.libraryHaskellDepends or []) ++ iohk-ops-extra-runtime-deps;
postInstall = ''
cp -vs $out/bin/iohk-ops $out/bin/io
wrapProgram $out/bin/iohk-ops \
--prefix PATH : "${pkgs.lib.makeBinPath iohk-ops-extra-runtime-deps}"
'';
}));
iohk-ops-integration-test = let
parts = with cardano-sl-pkgs.nix-tools.exes; [ cardano-sl-auxx cardano-sl-tools iohk-ops ];
in pkgs.runCommand "iohk-ops-integration-test" {} ''
mkdir -p $out/nix-support
export PATH=${pkgs.lib.makeBinPath parts}:$PATH
export CARDANO_SL_CONFIG=${cardano-sl-pkgs.cardanoConfig}
mkdir test
cp ${iohk-ops.src}/test/Spec.hs test # a file to hash
iohk-ops-integration-test | tee $out/test.log
if [ $? -ne 0 ]; then
touch $out/nix-support/failed
fi
exit 0
'';
IFDPins = let
f = k: s: "ln -sv ${s.outPath} $out/${k}";
mapSources = concatStringsSep "\n" (mapAttrsFlatten f sources);
in pkgs.runCommand "ifd-pins" {} ''
mkdir $out
cd $out
${mapSources}
'';
cachecacheSrc = sources.cachecache;
cachecache = pkgs.callPackage cachecacheSrc {};
in {
inherit nixops iohk-ops iohk-ops-integration-test log-classifier-web cachecache IFDPins cardano-node-pkgs;
terraform = pkgs.callPackage ./terraform/terraform.nix {};
mfa = pkgs.callPackage ./terraform/mfa.nix {};
checks = let
src = commonLib.cleanSourceTree ./.;
in {
shellcheck = pkgs.callPackage ./scripts/shellcheck.nix { inherit src; };
};
} // cardano-sl-pkgs