nixpkgs/pkgs
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
..
applications Merge pull request #85532 from marsam/update-lean 2020-04-19 10:00:27 +02:00
build-support Merge pull request #85468 from Ericson2314/no-dumpmachine 2020-04-18 00:35:19 -04:00
common-updater common-updater: add update script to all-packages 2020-04-15 23:02:33 -03:00
data fira: 4.106 -> 4.202 2020-04-19 01:58:03 +02:00
desktops Merge branch 'master' into staging-next 2020-04-18 07:42:26 +02:00
development Merge pull request #85473 from marsam/update-bazelisk 2020-04-19 02:38:52 -05:00
games Merge pull request #85284 from andersk/system-syzygy 2020-04-16 02:23:33 -04:00
misc Merge pull request #79246 from status-im/upgrade-brlaser 2020-04-18 14:23:43 -04:00
os-specific Merge #84442: staging-next branch 2020-04-18 23:11:00 +02:00
servers Merge #84442: staging-next branch 2020-04-18 23:11:00 +02:00
shells nix-zsh-completions: 0.4.3 -> 0.4.4 (#85267) 2020-04-15 12:00:14 +02:00
stdenv meta: expose availability flags in derivation metadata 2020-04-19 12:53:04 +02:00
test
tools Merge #84442: staging-next branch 2020-04-18 23:11:00 +02:00
top-level Merge #84442: staging-next branch 2020-04-18 23:11:00 +02:00