/
release.nix
41 lines (40 loc) · 1.7 KB
/
release.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
{ system ? builtins.currentSystem
, buildNum ? null
}:
let
daedalusPkgs = { cluster ? null }: import ./. {
inherit system buildNum cluster;
version = "${version}${suffix}";
};
shellEnvs = {
linux = import ./shell.nix { system = "x86_64-linux"; autoStartBackend = true; };
darwin = import ./shell.nix { system = "x86_64-darwin"; autoStartBackend = true; };
};
suffix = if buildNum == null then "" else "-${toString buildNum}";
version = (builtins.fromJSON (builtins.readFile (./. + "/package.json"))).version;
yaml2json = let
daedalusPkgsWithSystem = system: import ./. { inherit system; };
in {
x86_64-linux = (daedalusPkgsWithSystem "x86_64-linux").yaml2json;
x86_64-darwin = (daedalusPkgsWithSystem "x86_64-darwin").yaml2json;
};
makeJobs = cluster: with daedalusPkgs { inherit cluster; }; {
inherit daedalus;
installer = wrappedBundle newBundle pkgs cluster daedalus-bridge.version;
};
wrappedBundle = newBundle: pkgs: cluster: cardanoVersion: let
backend = "cardano-sl-${cardanoVersion}";
fn = "daedalus-${version}-${backend}-${cluster}-${system}${suffix}.bin";
in pkgs.runCommand fn {} ''
mkdir -pv $out/nix-support
cp ${newBundle} $out/${fn}
echo "file binary-dist $out/${fn}" >> $out/nix-support/hydra-build-products
size="$(stat $out/${fn} --printf="%s")"
echo installerSize $(($size / 1024 / 1024)) MB >> $out/nix-support/hydra-metrics
'';
lib = (import ./. {}).pkgs.lib;
clusters = lib.splitString " " (builtins.replaceStrings ["\n"] [""] (builtins.readFile ./installer-clusters.cfg));
in {
inherit shellEnvs yaml2json;
tests = (daedalusPkgs {}).tests;
} // builtins.listToAttrs (map (x: { name = x; value = makeJobs x; }) clusters)