1#!/usr/bin/env nix-shell
2# When using as a callable script, passing `--argstr path some/path` overrides $PWD.
3#!nix-shell -p nix -i "nix-env -qaP --no-name --out-path -f ci/eval/outpaths.nix"
4
5{
6 includeBroken ? true, # set this to false to exclude meta.broken packages from the output
7 path ? ./../..,
8
9 # used by ./attrpaths.nix
10 attrNamesOnly ? false,
11
12 # Set this to `null` to build for builtins.currentSystem only
13 systems ? builtins.fromJSON (builtins.readFile ../supportedSystems.json),
14}:
15let
16 lib = import (path + "/lib");
17
18 nixpkgsJobs =
19 import (path + "/pkgs/top-level/release.nix")
20 # Compromise: accuracy vs. resources needed for evaluation.
21 {
22 inherit attrNamesOnly;
23 supportedSystems = if systems == null then [ builtins.currentSystem ] else systems;
24 nixpkgsArgs = {
25 config = {
26 allowAliases = false;
27 allowBroken = includeBroken;
28 allowUnfree = true;
29 allowInsecurePredicate = x: true;
30 allowVariants = !attrNamesOnly;
31 checkMeta = true;
32
33 handleEvalIssue =
34 reason: errormsg:
35 let
36 fatalErrors = [
37 "unknown-meta"
38 "broken-outputs"
39 ];
40 in
41 if builtins.elem reason fatalErrors then
42 abort errormsg
43 # hydra does not build unfree packages, so tons of them are broken yet not marked meta.broken.
44 else if
45 !includeBroken
46 && builtins.elem reason [
47 "broken"
48 "unfree"
49 ]
50 then
51 throw "broken"
52 else if builtins.elem reason [ "unsupported" ] then
53 throw "unsupported"
54 else
55 true;
56
57 inHydra = true;
58 };
59
60 __allowFileset = false;
61 };
62 };
63
64 nixosJobs = import (path + "/nixos/release.nix") {
65 inherit attrNamesOnly;
66 supportedSystems = if systems == null then [ builtins.currentSystem ] else systems;
67 };
68
69 recurseIntoAttrs = attrs: attrs // { recurseForDerivations = true; };
70
71 # release-lib leaves recurseForDerivations as empty attrmaps;
72 # that would break nix-env and we also need to recurse everywhere.
73 tweak = lib.mapAttrs (
74 name: val:
75 if name == "recurseForDerivations" then
76 true
77 else if lib.isAttrs val && val.type or null != "derivation" then
78 recurseIntoAttrs (tweak val)
79 else
80 val
81 );
82
83 # Some of these contain explicit references to platform(s) we want to avoid;
84 # some even (transitively) depend on ~/.nixpkgs/config.nix (!)
85 blacklist = [
86 "tarball"
87 "metrics"
88 "manual"
89 "darwin-tested"
90 "unstable"
91 "stdenvBootstrapTools"
92 "moduleSystem"
93 "lib-tests" # these just confuse the output
94 ];
95
96in
97tweak (
98 (builtins.removeAttrs nixpkgsJobs blacklist)
99 // {
100 nixosTests.simple = nixosJobs.tests.simple;
101 }
102)