Stream: nix

Topic: Dependency graph


view this post on Zulip Aravind Gopal (Feb 14 2024 at 16:11):

Is there any way to get the graph of a dependency used in a project even though it’s not a direct input in the current project flakes.

view this post on Zulip Tim DeHerrera (Feb 14 2024 at 16:27):

nix path-info -r will give runtime deps, add --derivation to calculate build time deps, or nix-store - --requisites on a derivation will be buildtime deps on an output path will be runtime deps closure

view this post on Zulip Aravind Gopal (Feb 14 2024 at 20:04):

Thanks @Tim DeHerrera the above command returned all runtime deps. Is there any way to find the dependency graph . currently looking into nix-output-monitor (srid bro suggestion)

view this post on Zulip Tim DeHerrera (Feb 14 2024 at 20:09):

There are these two flags you can add to the nix-store variant I suggested. From the man page:

*        • --graph
*          Prints the references graph of the store paths paths in the format of the dot tool of AT&T’s Graphviz package. This  can  be
*          used  to visualise dependency graphs. To obtain a build-time dependency graph, apply this to a store derivation. To obtain a
*          runtime dependency graph, apply it to an output path.
*        • --graphml
*          Prints the references graph of the store paths paths in the GraphML file format. This can be used  to  visualise  dependency
*          graphs. To obtain a build-time dependency graph, apply this to a store derivation. To obtain a runtime dependency graph, ap‐
           ply it to an output path.

If that is what you are looking for.

view this post on Zulip Aravind Gopal (Feb 14 2024 at 20:30):

Thank you so much @Tim DeHerrera, This helped.

view this post on Zulip Srid (Feb 15 2024 at 10:45):

Nice, TIL!

nix-store --query --graph $(nix build --no-link --print-out-paths github:srid/emanote) | dot -Tsvg > output.svg

output.svg

image.png

view this post on Zulip Srid (Feb 15 2024 at 10:46):

This is worth a candidate to https://nixos.asia/en/tips

view this post on Zulip Srid (Feb 15 2024 at 10:50):

Srid said:

Nice, TIL!

nix-store --query --graph $(nix build --no-link --print-out-paths github:srid/emanote) | dot -Tsvg > output.svg

output.svg

output.png

Incidentally, this revealed to me that much of the bloat in emanote's closure is coming from nodejs (via tailwind).


Last updated: Nov 15 2024 at 12:33 UTC