nixos-search
nixos-search copied to clipboard
Be more resilient to nixpkgs errors
It's not the first time I see the import fail because e.g. someone put a string in meta.maintainers (cf. https://github.com/NixOS/nixos-search/issues/389). It would be nice to be more resilient to such failures, for example:
- in the particular case of maintainers, allow parsing a string as an entry
{name: name, github: null, email: null} - in general, don't fail the whole import if a single package or option fails to deserialise
I think we should fix this the other way around: putting a string into meta.maintainers should give an evaluation error in nixpkgs.
This should already be inforced by ofborg in nixpkgs via check-meta.nix which restricts the maintainers field to listOf (attrsOf str).
Ah but (listOf (attrsOf str)).check [ "foo" ] evaluates to true... Apparently listOf and attrsOf don't bother to check the types of their elements?
Relevant commits: https://github.com/NixOS/nixpkgs/commit/e4bc2592f3c5fa2f05484e7258f99ebb0507d304 and https://github.com/NixOS/nixpkgs/commit/8737d1783f8a8e0c219ec00dd995e8851fd65b3b (https://github.com/NixOS/nixpkgs/pull/6794)
Right, that's weird, but maybe something we can fix upstream, although I fear it may be quite the performance penalty for the already slow module system (the Of part seems to be mostly used to choose the proper merging behavior).
The current import failure is caused by a use of literalDocBook in an option description (https://github.com/NixOS/nixpkgs/pull/155928).
I think we should look again how are we importing flakes and nixpkgs.
How it works right now is quite easy to miss if some flakes are failing to import. With nixpkgs is a little better (we at least see a failed github action), but we are not really reporting it somewhere.
We need somehow to put things that fail into import into quarantine and report them to our matrix channel. And for things that are in quarantine we should use data from last successful import.