nixpkgs/pkgs/stdenv
Daiderd Jordan 950ac2bc8f
meta: expose availability flags in derivation metadata
Currently it's not possible to determine the reason why a package is
unavailable without evaluating nixpkgs multiple times with different
settings. eg.

    nix-repl> :p android-studio.meta
    { available = false; broken = false; unfree = true; unsupported = true; ... }

The following snippet is an example that uses this information to query
the availability information of all packages in nixpkgs, giving an
overview of all the packages currently marked as broken, etc.

    { pkgs }:

    with import <nixpkgs/lib>;

    let

      mapPkgs =
        let mapPkgs' = path: f: mapAttrs (n: v:
          let result = builtins.tryEval (v ? meta); in
          if !result.success then {} else
          if isDerivation v then f (path ++ [n]) v else
          if isAttrs v && v.recurseForDerivations or false then mapPkgs' (path ++ [n]) f v else
          {}
        );
        in mapPkgs' [];

      getMeta = path: drv:
        if drv.meta ? available then
          let meta = {
            pkg = concatStringsSep "." path;
            inherit (drv.meta) broken unfree unsupported insecure;
          };
          in builtins.trace meta.pkg meta
          else {};

      metaToList = attrs: flatten (map (v: if v ? pkg then v else metaToList v) (attrValues attrs));

    in metaToList (mapPkgs getMeta pkgs)
2020-04-19 12:53:04 +02:00
..
cross Fix lib tests 2019-11-26 12:57:16 -05:00
custom stdenv: allow custom stdenv to take crossOverlays 2019-01-07 20:53:10 -06:00
cygwin treewide: Make still dont* Variables are optional in most cases 2019-11-01 14:44:44 -04:00
darwin Merge staging-next into staging 2020-02-02 15:33:13 +01:00
freebsd stdenv: implement crossOverlays 2018-12-04 21:06:46 -06:00
generic meta: expose availability flags in derivation metadata 2020-04-19 12:53:04 +02:00
linux treewide: Per RFC45, remove all unquoted URLs 2020-04-10 17:54:53 +01:00
native treewide: remove redundant quotes 2019-08-26 21:40:19 +00:00
nix stdenv: implement crossOverlays 2018-12-04 21:06:46 -06:00
adapters.nix pkgsStatic: set BUILD_SHARED_LIBS=OFF for cmake 2020-01-03 11:31:17 -05:00
booter.nix pkgs/stdenv/booter.nix: Add comment explaining hasCC trickery 2019-12-30 18:09:45 -05:00
common-path.nix
default.nix treewide: remove redundant quotes 2019-08-26 21:40:19 +00:00