nixos-search icon indicating copy to clipboard operation
nixos-search copied to clipboard

Be more resilient to nixpkgs errors

Open ncfavier opened this issue 3 years ago • 6 comments

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

ncfavier avatar Dec 17 '21 22:12 ncfavier

I think we should fix this the other way around: putting a string into meta.maintainers should give an evaluation error in nixpkgs.

piegamesde avatar Dec 19 '21 12:12 piegamesde

This should already be inforced by ofborg in nixpkgs via check-meta.nix which restricts the maintainers field to listOf (attrsOf str).

sternenseemann avatar Dec 31 '21 13:12 sternenseemann

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)

ncfavier avatar Dec 31 '21 14:12 ncfavier

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).

sternenseemann avatar Dec 31 '21 15:12 sternenseemann

The current import failure is caused by a use of literalDocBook in an option description (https://github.com/NixOS/nixpkgs/pull/155928).

ncfavier avatar Jan 20 '22 19:01 ncfavier

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.

garbas avatar Apr 08 '22 09:04 garbas