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

Nix pure solution using exportReferencesGraph #9

Open
aciceri opened this issue Dec 4, 2023 · 4 comments
Open

Nix pure solution using exportReferencesGraph #9

aciceri opened this issue Dec 4, 2023 · 4 comments

Comments

@aciceri
Copy link

aciceri commented Dec 4, 2023

@GuillaumeDesforges Hey, cool project!

Just these days I had the same exact problem of getting the reference closure of a flake (more precisely the union of all the reference closures of all the derivations for a fixed system between a flake's outputs) and I solved it with a pure Nix machinery that creates a "super derivation" that references all the derivation outputs and then using exportReferencesGraph.

How this solution compares to mine in terms of performances in your opinion? Have you considered it and discarded for some reason?

Bonus: If I consider drvPahs instead of outPaths I get the complete build closure which is what I need in my use case. Would it be possible getting it using nixtract?

@GuillaumeDesforges
Copy link
Collaborator

Hi @aciceri, thanks a lot for sharing your thoughts! 🙂

How this solution compares to mine in terms of performances in your opinion? Have you considered it and discarded for some reason?

It has been mentioned at some point by one of our Nix exports internally, however I have not had the opportunity (=time) to try using it.

My overall thinking is that there are many ways to do the same thing and we need to find the most effective and stable one. If you are interested in proposing a PR I would be more than happy. 😄

Bonus: If I consider drvPahs instead of outPaths I get the complete build closure which is what I need in my use case. Would it be possible getting it using nixtract?

I am not sure I understand what you mean by that 👀 could you please explain more in details?

@aciceri
Copy link
Author

aciceri commented Dec 4, 2023

I am not sure I understand what you mean by that 👀 could you please explain more in details?

I'm working on a minimal proof of concept, I can share it here as soon as it's ready. So hopefully we can also compare it with this approach in terms of performances.

Anyway try to build pkgs.writeReferencesToFile pkgs.hello.outPath and pkgs.writeReferencesToFile pkgs.hello.drvPath. In the first case it builds a file containing all the derivation outputs (recursively) referenced by pkgs.hello.outPath while in the second one you get a list of all the derivations (both outputs and drv files) in the build closure.

My overall thinking is that there are many ways to do the same thing and we need to find the most effective and stable one. If you are interested in proposing a PR I would be more than happy.

Sure! I would be glad of doing that if it makes sense (still don't know pros/conses of the two approaches).

@aciceri
Copy link
Author

aciceri commented Jan 9, 2024

@GuillaumeDesforges This is an experiment I worked on this weekend, it has many problems (ignore the README that states false things) but it seems to work for derivations in the packages output.

@GuillaumeDesforges
Copy link
Collaborator

Hey! Just to say that I've had a quick look at it. I don't have the bandwidth to check right now but will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants