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