search: allow caching results; new interface & local endpoints
Includes three new changes: channel deprecation, result caching, and fallback search methods.
We now mark NixOS 24.05 as deprecated, and hard-error if the user attempts to search with a deprecated channnel; NixOS considers those insecure, and so should we.
More importantly, search results can now be cached locally to help with performance of subsequent searches, and reduce network requests. With long cache durations, it might even be possible to support fully offline search but I have different ideas on how to approach this. The cache system stores results in the $HOME/.cache/nh directory with filenames based on a hash of the query and channel. Cache entries include timestamps and expire after 3600 seconds by default, though this duration is configurable via the new --cache-duration option. Users can toggle caching with the --use-cache flag. Worth nothing that the cache files are not cleaned automatically, maybe the nh module can handle that.
When primary elasticsearch searches fail (happens more often than I'd like to see), the system can now fall back to alternative methods. These include checking a local file specified by --fallback-file or querying custom endpoints provided through --fallback-endpoints. Fallback endpoints support template variables like {channel} and {query} for dynamic requests. This mechanism is activated only if the primary search fails and can be disabled with --use-fallback=false if so desired.
I've also went ahead and added corresponding environment variables for persistent configuration in the light of Viper's vision.