Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump all reachable derivations #1187

Open
lukego opened this issue Jan 13, 2017 · 6 comments
Open

Dump all reachable derivations #1187

lukego opened this issue Jan 13, 2017 · 6 comments
Assignees
Labels
cli The old and/or new command line interface feature Feature request or proposal stale

Comments

@lukego
Copy link

lukego commented Jan 13, 2017

I would like to make a simple tool to visualizes a set of derivations e.g. all of the ones in nixpkgs. The tool would allow searching (like nox) but also navigating through build-time and run-time dependencies (like Hydra.)

Question: How can I take a snapshot of all the necessary data such that I can import it into the tool all at once?

I see that nox uses nix-env -qa --json and while this seems to contain much of what I want (list of derivations, their descriptions, some metadata) is does not seem to have everything (e.g. the dependency graph.) I have not found anything more suitable in the nix-store manpage. I wonder if I need to be parsing the .drv files but then the question is how to ensure that all the relevant ones exist and how to identify the subset I am interested in e.g. reachable from the result of import <nixpkgs>.

Tips would be welcome! (This is for the first steps of the Studio project.)

@domenkozar
Copy link
Member

@edolstra I remember Hydra does this, but not sure how to get the information with recent refactorings.

@vcunat
Copy link
Member

vcunat commented Jan 13, 2017

For build-time graph you can get derivation paths nix-env -q --drv-path and then create the graph via nix-store -q --graph.

Runtime dependencies are unknowable until you build the stuff, but you can get output paths nix-env -q --out-path and after building the packages you can even graph on those in the same way.

@lukego
Copy link
Author

lukego commented Jan 13, 2017

Thanks for the info! Seems that nix-env -q --attr-path answers what was going to be my follow-on question :).

@lukego
Copy link
Author

lukego commented Jan 13, 2017

I did come up with a new question anyway :-). It takes a while to generate this description and I would like to cache it. Can I do that with nix? (Can I use nix-build to create this description of nixpkgs and have it automatically regenerate when stale? Or should I cook up some ad-hoc caching scheme of my own?)

@vcunat
Copy link
Member

vcunat commented Jan 13, 2017

nox does such things in some way; nix doesn't. I think it would be really difficult to do properly, as there are lots of things that can theoretically affect evaluation – environment variables, your configs, etc.

@stale
Copy link

stale bot commented Feb 15, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the stale label Feb 15, 2021
@fricklerhandwerk fricklerhandwerk added feature Feature request or proposal cli The old and/or new command line interface labels Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli The old and/or new command line interface feature Feature request or proposal stale
Projects
None yet
Development

No branches or pull requests

6 participants