-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathrelease.nix
More file actions
101 lines (95 loc) · 2.5 KB
/
Copy pathrelease.nix
File metadata and controls
101 lines (95 loc) · 2.5 KB
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
{
systems ? [ "x86_64-linux" ],
nixpkgs ? <nixpkgs>,
lixSrc ? builtins.fetchGit ./.,
}:
let
nixpkgs' =
if builtins.isAttrs nixpkgs then
nixpkgs
else
{
outPath = nixpkgs;
rev = "0000000000000000000000000000000000000000";
shortRev = "0000000";
};
in
let
nixpkgs = nixpkgs';
in
let
flakeLock = builtins.fromJSON (builtins.readFile (lixSrc + "/flake.lock"));
fetchFlakeLockInputs =
names:
lib.listToAttrs (
map (
inputName:
let
nodeName = flakeLock.nodes.${flakeLock.root}.inputs.${inputName};
in
lib.nameValuePair inputName (builtins.fetchTree flakeLock.nodes.${nodeName}.locked)
) names
);
lib = import (nixpkgs + "/lib");
filterSystems = lib.filter (n: builtins.elem n systems);
inputs =
(import (lixSrc + "/nix-support/build/inputs.nix") (
fetchFlakeLockInputs [
"nix2container"
"nixpkgs-regression"
"nix_2_18"
]
// {
inherit lib nixpkgs lixSrc;
}
)).overrideScope
(
_: prev: {
linux32BitSystems = filterSystems prev.linux32BitSystems;
linux64BitSystems = filterSystems prev.linux64BitSystems;
darwinSystems = filterSystems prev.darwinSystems;
}
);
outputs = inputs.callPackage (lixSrc + "/nix-support/build/outputs.nix") { };
in
lib.fix (
self:
outputs.ciArtifacts
// {
inherit (outputs) tests;
# Aggregate job that is finished in Hydra _after_ all constituent jobs (here: grouped by system)
# succeed.
# This is used to run CD scripts once all builds are finished on Hydra.
release = inputs.forAllSystems (
system:
let
pkgs = inputs.nixpkgsFor.${system}.native;
in
pkgs.runCommand "release"
{
_hydraAggregate = true;
constituents = lib.filter (x: x != null) (
lib.mapAttrsToListRecursiveCond
(_: val: !(lib.isDerivation val || builtins.any (system': val ? ${system'}) systems))
(
path: drv:
if drv ? ${system} then
lib.concatStringsSep "." (path ++ [ system ])
else if drv.system or null == system then
lib.concatStringsSep "." path
else
null
)
(
removeAttrs self [
"release"
]
)
);
}
''
touch $out
''
);
}
)