Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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 --arg checkMeta true -f pkgs/top-level/release-outpaths.nix"
4
5# Vendored from:
6# https://raw.githubusercontent.com/NixOS/ofborg/74f38efa7ef6f0e8e71ec3bfc675ae4fb57d7491/ofborg/src/outpaths.nix
7{
8 checkMeta,
9 includeBroken ? true, # set this to false to exclude meta.broken packages from the output
10 path ? ./../..,
11
12 # used by pkgs/top-level/release-attrnames-superset.nix
13 attrNamesOnly ? false,
14
15 # Set this to `null` to build for builtins.currentSystem only
16 systems ? builtins.fromJSON (builtins.readFile ../../ci/supportedSystems.json),
17}:
18let
19 lib = import (path + "/lib");
20 hydraJobs =
21 import (path + "/pkgs/top-level/release.nix")
22 # Compromise: accuracy vs. resources needed for evaluation.
23 {
24 inherit attrNamesOnly;
25 supportedSystems = if systems == null then [ builtins.currentSystem ] else systems;
26 nixpkgsArgs = {
27 config = {
28 allowAliases = false;
29 allowBroken = includeBroken;
30 allowUnfree = true;
31 allowInsecurePredicate = x: true;
32 allowVariants = !attrNamesOnly;
33 checkMeta = checkMeta;
34
35 handleEvalIssue =
36 reason: errormsg:
37 let
38 fatalErrors = [
39 "unknown-meta"
40 "broken-outputs"
41 ];
42 in
43 if builtins.elem reason fatalErrors then
44 abort errormsg
45 # hydra does not build unfree packages, so tons of them are broken yet not marked meta.broken.
46 else if
47 !includeBroken
48 && builtins.elem reason [
49 "broken"
50 "unfree"
51 ]
52 then
53 throw "broken"
54 else if builtins.elem reason [ "unsupported" ] then
55 throw "unsupported"
56 else
57 true;
58
59 inHydra = true;
60 };
61
62 __allowFileset = false;
63 };
64 };
65 recurseIntoAttrs = attrs: attrs // { recurseForDerivations = true; };
66
67 # hydraJobs leaves recurseForDerivations as empty attrmaps;
68 # that would break nix-env and we also need to recurse everywhere.
69 tweak = lib.mapAttrs (
70 name: val:
71 if name == "recurseForDerivations" then
72 true
73 else if lib.isAttrs val && val.type or null != "derivation" then
74 recurseIntoAttrs (tweak val)
75 else
76 val
77 );
78
79 # Some of these contain explicit references to platform(s) we want to avoid;
80 # some even (transitively) depend on ~/.nixpkgs/config.nix (!)
81 blacklist = [
82 "tarball"
83 "metrics"
84 "manual"
85 "darwin-tested"
86 "unstable"
87 "stdenvBootstrapTools"
88 "moduleSystem"
89 "lib-tests" # these just confuse the output
90 ];
91
92in
93tweak (builtins.removeAttrs hydraJobs blacklist)