Last active
February 23, 2017 09:17
-
-
Save moretea/a28f0fa2afe99fc6cd026ac56460bf84 to your computer and use it in GitHub Desktop.
List all packages filtered by some maintainer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#usage: | |
# nix-instantiate --arg maintainer "\"Matthias Beyer <mail@beyermatthias.de>\"" --strict --json --eval ./all-packages-of-a-maintainer.nix | $(nix-build '<nixpkgs>' -A jq)/bin/jq | |
with (import <nixpkgs> {}); | |
with lib; | |
{ maintainer }: | |
let | |
filter = k: v: | |
let | |
evalResult = builtins.tryEval ( | |
if (builtins.typeOf v) == "set" && (builtins.hasAttr "meta" v) && (builtins.hasAttr "maintainers" v.meta) | |
then if (builtins.typeOf v.meta.maintainers) == "list" | |
then | |
builtins.elem maintainer v.meta.maintainers | |
else if builtins.typeOf v.meta.maintainers == "string" | |
then v.meta.maintainers == maintainer | |
else false | |
else false | |
); | |
in | |
if evalResult.success | |
then evalResult.value | |
else false; | |
in | |
filterAttrs filter pkgs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment