Skip to content

Commit 221a7ad

Browse files
Try #1761:
2 parents 6cf5f8f + 9e05b33 commit 221a7ad

File tree

6 files changed

+61
-84
lines changed

6 files changed

+61
-84
lines changed

.buildkite/pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ steps:
152152

153153
- label: 'Check that evaluation of hydra jobs works without using remote builders'
154154
command:
155-
- nix-instantiate release.nix -A required-unstable-ghc8107-x86_64-darwin-native --show-trace --builders ''
155+
- nix-instantiate release.nix -A x86_64-darwin.required-unstable-ghc8107-native --show-trace --builders ''
156156
agents:
157157
system: x86_64-linux
158158

build.nix

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
#
33
# It is separate from default.nix because that file is the public API
44
# of Haskell.nix, which shouldn't have tests, etc.
5-
let
6-
haskellNix = (import ./default.nix {});
7-
in
85
{ nixpkgs ? haskellNix.sources.nixpkgs-unstable
96
, nixpkgsArgs ? haskellNix.nixpkgsArgs
107
, pkgs ? import nixpkgs nixpkgsArgs
@@ -13,6 +10,7 @@ in
1310
, pkgsForHydra ? import nixpkgsForHydra (nixpkgsArgs // { inherit (pkgs) system; })
1411
, ifdLevel ? 1000
1512
, compiler-nix-name ? throw "No `compiler-nix-name` passed to build.nix"
13+
, haskellNix ? (import ./default.nix {})
1614
}:
1715

1816
let

ci-lib.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
# Generic nixpkgs, use *only* for lib functions that are stable across versions
3-
pkgs ? (import ./. {}).pkgs,
3+
pkgs, # ? (import ./. {}).pkgs,
44
lib ? pkgs.lib
55
}: rec {
66
inherit (import ./dimension.nix) dimension;

ci.nix

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
# 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating
22
# on a machine with e.g. no way to build the Darwin IFDs you need!
3-
{ supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ]
4-
, ifdLevel ? 3
3+
{ ifdLevel ? 3
54
# Whether or not we are evaluating in restricted mode. This is true in Hydra, but not in Hercules.
65
, restrictEval ? false
76
, checkMaterialization ? false
8-
, pkgs ? (import ./. {}).pkgs }:
7+
, compat
8+
, system
9+
, pkgs ? (compat { inherit system; }).pkgs }:
910
let
1011
inherit (import ./ci-lib.nix { inherit pkgs; }) dimension platformFilterGeneric filterAttrsOnlyRecursive;
1112
inherit (pkgs.haskell-nix) sources;
1213
nixpkgsVersions = {
1314
"R2205" = "nixpkgs-2205";
1415
"unstable" = "nixpkgs-unstable";
1516
};
16-
haskellNix = import ./default.nix { inherit checkMaterialization; };
17+
haskellNix = compat { inherit checkMaterialization system; };
1718
nixpkgsArgs = haskellNix.nixpkgsArgs // {
1819
# Needed for dwarf tests
1920
config = haskellNix.nixpkgsArgs.config // {
@@ -52,8 +53,8 @@
5253
# aarch64-linux requires ghc 8.8.4
5354
(v != "aarch64-linux" || (
5455
!__elem compiler-nix-name ["ghc865" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]
55-
))) supportedSystems) (v: v);
56-
crossSystems = nixpkgsName: nixpkgs: compiler-nix-name: system:
56+
))) [ system ]) (v: v);
57+
crossSystems = nixpkgsName: nixpkgs: compiler-nix-name:
5758
# We need to use the actual nixpkgs version we're working with here, since the values
5859
# of 'lib.systems.examples' are not understood between all versions
5960
let lib = nixpkgs.lib;
@@ -76,9 +77,8 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
7677
let pinnedNixpkgsSrc = sources.${nixpkgs-pin};
7778
evalPackages = import pinnedNixpkgsSrc nixpkgsArgs;
7879
in dimension "GHC version" (compilerNixNames nixpkgsName evalPackages) (compiler-nix-name: {runTests}:
79-
dimension "System" (systems nixpkgsName evalPackages compiler-nix-name) (systemName: system:
8080
let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system; });
81-
build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name; };
81+
build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name haskellNix; };
8282
platformFilter = platformFilterGeneric pkgs system;
8383
in filterAttrsOnlyRecursive (_: v: platformFilter v && !(isDisabled v)) ({
8484
# Native builds
@@ -95,10 +95,10 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
9595
});
9696
}
9797
//
98-
dimension "Cross system" (crossSystems nixpkgsName evalPackages compiler-nix-name system) (crossSystemName: crossSystem:
98+
dimension "Cross system" (crossSystems nixpkgsName evalPackages compiler-nix-name) (crossSystemName: crossSystem:
9999
# Cross builds
100100
let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; });
101-
build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name; };
101+
build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name haskellNix; };
102102
in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) ({
103103
roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
104104
ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}";
@@ -119,4 +119,3 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
119119
))
120120
)
121121
)
122-
)

flake.nix

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,37 @@
134134

135135
packages = ((self.internal.compat { inherit system; }).hix).apps;
136136

137+
ciJobs =
138+
let
139+
inherit (legacyPackages) lib;
140+
inherit (import ./ci-lib.nix { pkgs = legacyPackagesUnstable; }) stripAttrsForHydra filterDerivations;
141+
ci = import ./ci.nix { inherit (self.internal) compat; inherit system; };
142+
allJobs = stripAttrsForHydra (filterDerivations ci);
143+
names = x: lib.filter (n: n != "recurseForDerivations" && n != "meta")
144+
(builtins.attrNames x);
145+
requiredJobs =
146+
builtins.listToAttrs (
147+
lib.concatMap (nixpkgsVer:
148+
let nixpkgsJobs = allJobs.${nixpkgsVer};
149+
in lib.concatMap (compiler-nix-name:
150+
let ghcJobs = nixpkgsJobs.${compiler-nix-name};
151+
in (
152+
builtins.map (crossPlatform: {
153+
name = "required-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}";
154+
value = legacyPackages.releaseTools.aggregate {
155+
name = "haskell.nix-${nixpkgsVer}-${compiler-nix-name}-${crossPlatform}";
156+
meta.description = "All ${nixpkgsVer} ${compiler-nix-name} ${crossPlatform} jobs";
157+
constituents = lib.collect (d: lib.isDerivation d) ghcJobs.${crossPlatform};
158+
};
159+
}) (names ghcJobs))
160+
) (names nixpkgsJobs)
161+
) (names allJobs));
162+
in {
163+
latest = allJobs.unstable.ghc8107.native or {};
164+
} // requiredJobs;
165+
166+
hydraJobs = ciJobs;
167+
137168
devShells = with self.legacyPackages.${system}; {
138169
default =
139170
mkShell {

release.nix

Lines changed: 17 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,19 @@
1-
# 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating
2-
# on a machine with e.g. no way to build the Darwin IFDs you need!
3-
{ supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ]
4-
, ifdLevel ? 3
5-
, include ? (compiler-nix-name: true)
6-
, checkMaterialization ? false }:
1+
# TODO remove this file when we no longer need to build with the
2+
# non flake hydra configuration.
3+
{
4+
supportedSystems ? ["x86_64-linux" "x86_64-darwin"],
5+
}: let
6+
defaultNix = import ./. {};
77

8-
let
9-
traceNames = prefix: builtins.mapAttrs (n: v:
10-
if builtins.isAttrs v
11-
then if v ? type && v.type == "derivation"
12-
then __trace (prefix + n) v
13-
else traceNames (prefix + n + ".") v
14-
else v);
15-
inherit (import ./ci-lib.nix { pkgs = genericPkgs; }) stripAttrsForHydra filterDerivations;
16-
genericPkgs = (import ./. {}).pkgs;
17-
lib = genericPkgs.lib;
18-
ci = import ./ci.nix { inherit supportedSystems ifdLevel checkMaterialization; restrictEval = true; };
19-
allJobs = stripAttrsForHydra (filterDerivations ci);
20-
latestJobs = lib.optionalAttrs (include "ghc8107") {
21-
# All the jobs are included in the `requiredJobs`, but the ones
22-
# added here will also included without aggregation, making it easier
23-
# to find a failing test. Keep in mind though that adding too many
24-
# of these will slow down eval times.
25-
x86_64-linux = allJobs.unstable.ghc8107.x86_64-linux.native or {};
26-
x86_64-darwin = allJobs.unstable.ghc8107.x86_64-darwin.native or {};
27-
};
28-
names = x: lib.filter (n: n != "recurseForDerivations" && n != "meta")
29-
(builtins.attrNames x);
30-
requiredJobs =
31-
builtins.listToAttrs (
32-
lib.concatMap (nixpkgsVer:
33-
let nixpkgsJobs = allJobs.${nixpkgsVer};
34-
in lib.concatMap (compiler-nix-name:
35-
let ghcJobs = nixpkgsJobs.${compiler-nix-name};
36-
in lib.optionals (include compiler-nix-name) (builtins.concatMap (platform:
37-
let platformJobs = ghcJobs.${platform};
38-
in builtins.map (crossPlatform: {
39-
name = "required-${nixpkgsVer}-${compiler-nix-name}-${platform}-${crossPlatform}";
40-
value = genericPkgs.releaseTools.aggregate {
41-
name = "haskell.nix-${nixpkgsVer}-${compiler-nix-name}-${platform}-${crossPlatform}";
42-
meta.description = "All ${nixpkgsVer} ${compiler-nix-name} ${platform} ${crossPlatform} jobs";
43-
constituents = lib.collect (d: lib.isDerivation d) platformJobs.${crossPlatform};
44-
};
45-
}) (names platformJobs)
46-
) (names ghcJobs))
47-
) (names nixpkgsJobs)
48-
) (names allJobs));
49-
in traceNames "job " (latestJobs // requiredJobs // {
50-
windows-secp256k1 =
51-
let
52-
pkgs = (import ./. {}).pkgs-unstable;
53-
makeBinDist = drv: pkgs.runCommand drv.name {
54-
nativeBuildInputs = [ pkgs.zip ];
55-
} ''
56-
mkdir -p $out/nix-support
57-
cp -r ${drv}/* .
58-
chmod -R +w .
59-
zip -r $out/${drv.name}.zip .
60-
echo "file binary-dist $out/${drv.name}.zip" > $out/nix-support/hydra-build-products
61-
'';
62-
in makeBinDist pkgs.pkgsCross.mingwW64.secp256k1;
63-
required = genericPkgs.releaseTools.aggregate {
64-
name = "haskell.nix-required";
65-
meta.description = "All jobs required to pass CI";
66-
# Using the names here requires https://github.com/NixOS/hydra/issues/715
67-
constituents = builtins.attrNames requiredJobs;
68-
};
69-
})
8+
inherit (defaultNix) pkgs;
9+
inherit (pkgs) lib;
10+
11+
jobs = lib.getAttrs supportedSystems defaultNix.ciJobs;
7012

13+
required = defaultNix.pkgs.releaseTools.aggregate {
14+
name = "github-required";
15+
meta.description = "All jobs required to pass CI";
16+
constituents = lib.collect lib.isDerivation jobs;
17+
};
18+
in
19+
jobs // { inherit required; }

0 commit comments

Comments
 (0)