NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
11.79k stars 1.45k forks source link

Machine readable nix why-depends #10996

Open DieracDelta opened 1 month ago

DieracDelta commented 1 month ago

Is your feature request related to a problem? Please describe. I'd like to query nix why-depends and parse the output. The output is currently unstructured.

Describe the solution you'd like Ideally a cli option for returning the output as JSON or another similar format would make this much easier.

Describe alternatives you've considered N/A

Additional context N/A

Priorities

Add :+1: to issues you find important.

roberth commented 1 month ago

JSON would be our choice, as we already have some commands that support --json.

The architecture for this kind of thing is to have it produce typed C++ data that can be rendered either to JSON or to the terminal. We also have guidelines for JSON output.