Hello,
For some project, I’d like to be able to go through all the packages, and extract some information. Unfortunately, using lib.attrsets.mapAttrsToList
, I keep running into errors because of:
- Broken packages
- Unsupported packages for my system
- Packages that are not marked broken but still seem to break?
For instance, on OSX:
let
nixpkgs = import <nixpkgs> {};
isValid = d:
let r = builtins.tryEval (nixpkgs.lib.isDerivation d && ! (nixpkgs.lib.attrByPath [ "meta" "broken" ] false r));
in r.success && r.value;
validPkgs = nixpkgs.lib.filterAttrs (k: v: isValid v) nixpkgs.pkgs;
in
nixpkgs.lib.attrsets.mapAttrsToList (k: v: v.name) validPkgs
has a bunch of errors:
«error: Package ‘libdbusmenu-gtk3-16.04.0’ in /nix/store/ncawd0mgp0f7y8qv3jx7sqgydaafaf5d-nixpkgs-19.03.172530.096e2f137b6/nixpkgs/pkgs/development/libraries/libdbusmenu/default.nix:58 is not supported on ‘x86_64-apple-darwin’, refusing to evaluate.
a) For `nixos-rebuild` you can set
{ nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.
b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.
»
«error: assertion failed at /nix/store/ncawd0mgp0f7y8qv3jx7sqgydaafaf5d-nixpkgs-19.03.172530.096e2f137b6/nixpkgs/pkgs/os-specific/linux/kernel/generic.nix:53:1» "rtl_433-18.12" «error: assertion failed at /nix/store/ncawd0mgp0f7y8qv3jx7sqgydaafaf5d-nixpkgs-19.03.172530.096e2f137b6/nixpkgs/pkgs/os-specific/linux/kernel/generic.nix:53:1»
Is there a better way of traversing the available, working packages?