package-list.hs: improve the algorithm used to compute the Nix package set

This is a "snapshot commit" to archive the current (seemingly stable) state.
Needs more testing.