Skip to content

Commit d562aa2

Browse files
Try #1761:
2 parents a59f6fc + 47ee837 commit d562aa2

File tree

6 files changed

+86
-108
lines changed

6 files changed

+86
-108
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: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,61 @@
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 // {
2021
permittedInsecurePackages = ["libdwarf-20210528" "libdwarf-20181024" "dwarfdump-20181024"];
2122
};
2223
};
23-
compilerNixNames = nixpkgsName: nixpkgs: builtins.mapAttrs (compiler-nix-name: runTests: {
24-
inherit runTests;
25-
}) (
26-
# GHC version to cache and whether to run the tests against them.
27-
# This list of GHC versions should include everything for which we
28-
# have a ./materialized/ghcXXX directory containing the materialized
29-
# cabal-install and nix-tools plans. When removing a ghc version
30-
# from here (so that is no longer cached) also remove ./materialized/ghcXXX.
31-
# Update supported-ghc-versions.md to reflect any changes made here.
32-
nixpkgs.lib.optionalAttrs (nixpkgsName == "R2205") {
33-
ghc865 = false;
34-
ghc8107 = false;
35-
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "unstable") {
36-
ghc865 = false;
37-
ghc884 = false; # Native version is used to boot 9.0.1
38-
ghc8107 = true;
39-
ghc902 = false;
40-
ghc924 = true;
41-
});
42-
systems = nixpkgsName: nixpkgs: compiler-nix-name: nixpkgs.lib.genAttrs (
43-
nixpkgs.lib.filter (v:
24+
compilerNixNames = nixpkgsName: nixpkgs:
25+
# Include only the GHC versions that are supported by haskell.nix
26+
nixpkgs.lib.filterAttrs (compiler-nix-name: _:
4427
# We have less x86_64-darwin build capacity so build fewer GhC versions
45-
(v != "x86_64-darwin" || (
28+
(system != "x86_64-darwin" || (
4629
!__elem compiler-nix-name ["ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]))
4730
&&
4831
# aarch64-darwin requires ghc 8.10.7
49-
(v != "aarch64-darwin" || (
32+
(system != "aarch64-darwin" || (
5033
!__elem compiler-nix-name ["ghc865" "ghc884" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]))
5134
&&
5235
# aarch64-linux requires ghc 8.8.4
53-
(v != "aarch64-linux" || (
36+
(system != "aarch64-linux" || (
5437
!__elem compiler-nix-name ["ghc865" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]
55-
))) supportedSystems) (v: v);
56-
crossSystems = nixpkgsName: nixpkgs: compiler-nix-name: system:
38+
)))
39+
(builtins.mapAttrs (compiler-nix-name: runTests: {
40+
inherit runTests;
41+
}) (
42+
# GHC version to cache and whether to run the tests against them.
43+
# This list of GHC versions should include everything for which we
44+
# have a ./materialized/ghcXXX directory containing the materialized
45+
# cabal-install and nix-tools plans. When removing a ghc version
46+
# from here (so that is no longer cached) also remove ./materialized/ghcXXX.
47+
# Update supported-ghc-versions.md to reflect any changes made here.
48+
nixpkgs.lib.optionalAttrs (nixpkgsName == "R2205") {
49+
ghc865 = false;
50+
ghc8107 = false;
51+
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "unstable") {
52+
ghc865 = false;
53+
ghc884 = false; # Native version is used to boot 9.0.1
54+
ghc8107 = true;
55+
ghc902 = false;
56+
ghc924 = true;
57+
}));
58+
crossSystems = nixpkgsName: nixpkgs: compiler-nix-name:
5759
# We need to use the actual nixpkgs version we're working with here, since the values
5860
# of 'lib.systems.examples' are not understood between all versions
5961
let lib = nixpkgs.lib;
@@ -76,9 +78,8 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
7678
let pinnedNixpkgsSrc = sources.${nixpkgs-pin};
7779
evalPackages = import pinnedNixpkgsSrc nixpkgsArgs;
7880
in dimension "GHC version" (compilerNixNames nixpkgsName evalPackages) (compiler-nix-name: {runTests}:
79-
dimension "System" (systems nixpkgsName evalPackages compiler-nix-name) (systemName: system:
8081
let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system; });
81-
build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name; };
82+
build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name haskellNix; };
8283
platformFilter = platformFilterGeneric pkgs system;
8384
in filterAttrsOnlyRecursive (_: v: platformFilter v && !(isDisabled v)) ({
8485
# Native builds
@@ -95,10 +96,10 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
9596
});
9697
}
9798
//
98-
dimension "Cross system" (crossSystems nixpkgsName evalPackages compiler-nix-name system) (crossSystemName: crossSystem:
99+
dimension "Cross system" (crossSystems nixpkgsName evalPackages compiler-nix-name) (crossSystemName: crossSystem:
99100
# Cross builds
100101
let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; });
101-
build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name; };
102+
build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name haskellNix; };
102103
in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) ({
103104
roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
104105
ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}";
@@ -119,4 +120,3 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
119120
))
120121
)
121122
)
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)