nix-community / noogle

https://noogle.dev - nix function exploring. [maintainer=@hsjobeki]
https://noogle.dev
MIT License
341 stars 8 forks source link

Machine-readable format #114

Open viperML opened 6 months ago

viperML commented 6 months ago

Hello!

I am one of the moderators of the nixos discord (https://discord.gg/RbvHtGa), and we thought it would be nice to integrate noogle into a bot, so people can /search <function_name>

From what I get from the readme, noogle is build as a static webpage, so could it be possible to get a machine-readadable format (e.g. json) that we can embed into the bot?

Maybe this already exists, or could be possible to implement?

hsjobeki commented 6 months ago

Hey :+1: noogle's data roughly exists as a json file. There is a little more data, as other files, but maybe you can start with integrating the major dataset if you are interested:

nix build .#data-json

I'll look if i can provide a more unified output of all the data until then.

viperML commented 6 months ago

Is the detected type available in data-json ?

hsjobeki commented 6 months ago

Yes it is for most functions.

This is the internal data-structure behind entries in data-json https://github.com/nix-community/noogle/blob/d364719ef1e9a402c934564fa824ee9792edadd5/pesto/src/main.rs#L166C1-L184C2

I have some pre-defined types for the builtins in a separate file as well: https://github.com/nix-community/noogle/blob/main/salt/src/builtins.types.json

If you want to work on providing a unified output of all the information, I am happy to help.

viperML commented 6 months ago

Ah yes, my bad. I skimmed the resulting json, and only read the functions for which signature was null.