forked from NixOS/ofborg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.nix
70 lines (63 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
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
{ nixpkgs ? ./nix
, supportedSystems ? [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ]
}:
let
pkgs = import nixpkgs {};
inherit (pkgs) lib;
# An attrset of borgpkgs per supportedSystem:
#
# {
# "x86_64-linux" = ...
# "x86_64-darwin" = ...
# }
borgpkgs-per-arch = builtins.foldl'
(collector: system:
collector // {
"${system}" = import ./. {
pkgs = import nixpkgs { inherit system; };
};
}
)
{} supportedSystems;
attrForSystem = system: attrpath:
if borgpkgs-per-arch ? "${system}"
then (
let
borgpkgs = borgpkgs-per-arch."${system}";
in if lib.hasAttrByPath attrpath borgpkgs
then lib.setAttrByPath
(attrpath ++ [system])
(lib.attrByPath attrpath "bogus" borgpkgs)
else throw "Failed to find ${toString attrpath} for ${system} in borgpkgs"
)
else throw "No such system ${system}";
attrsForAllSystems = path:
builtins.foldl'
(collector: system:
lib.recursiveUpdate collector (attrForSystem system path)
)
{}
supportedSystems;
merge = attrsets:
builtins.foldl'
(collector: set: lib.recursiveUpdate set collector)
{}
attrsets;
x8664LinuxOnly = path:
(attrForSystem "x86_64-linux" path);
jobs = merge [
(attrsForAllSystems [ "ofborg" "rs" ])
(x8664LinuxOnly [ "ofborg" "php" ])
];
in jobs // {
release = pkgs.releaseTools.aggregate {
name = "release";
meta.description = "Release-critical builds for OfBorg infrastructure";
constituents = [
jobs.ofborg.rs.x86_64-linux
jobs.ofborg.rs.x86_64-darwin
# jobs.ofborg.rs.aarch64-linux
jobs.ofborg.php.x86_64-linux
];
};
}