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

[WIP] Use all flake outputs #19

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aciceri
Copy link

@aciceri aciceri commented Jan 5, 2024

I expected nixtract to give out the graph of derivations for all the derivations between outputs, instead of just considering packages, legacyPackages and defaultPackage.

In the use case we were thinking to use this in I needed all the derivations indeed, changes in this PR should do it.
This is a big change so perhaps you want this guarded by a cli flag? In my opinion this should be the default but perhaps I'm missing your use case for this project.

Notice that the hardcoded list of outputs could be not exhaustive. Also I believe it would be nice a more versatile version of --target-attribute-path but I'm not sure about the interface.
When (and if) this will be merged it could be interesting using it.

At the beginning it seemed that my changes worked but then I found something unexpected, currently I commented out all the outputs except nixosConfigurations because I noticed something weird.

For instance if I run nix run .#default -- --target-flake-ref "github:aciceri/nixfleet" - (that is my personal flake with my NixOS configurations, I suggest to try with something smaller if you don't want to build/fetch a lot of stuff) I get the following:

warning: Git tree '/home/ccr/projects/mlabs-haskell/nixtract' is dirty
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
trace: warning: The option `services.avahi.nssmdns' defined in `/nix/store/lgr8z886bkwyx8ncgm10vsrnfgxyg99a-source/modules/printing' has been renamed to `services.avahi.nssmdns4'.
trace: warning: The option `services.avahi.nssmdns' defined in `/nix/store/lgr8z886bkwyx8ncgm10vsrnfgxyg99a-source/modules/printing' has been renamed to `services.avahi.nssmdns4'.
{"attribute_path": "kirk.out", "derivation_path": "/nix/store/40fh3aifv66i36hccasl5c1kkwja230h-nixos-system-kirk-24.05.20240102.bd645e8.drv", "output_path": "/nix/store/w3p5316vhdi7q9cab1nqq9971rgh9cw5-nixos-system-kirk-24.05.20240102.bd645e8", "outputs": [{"name": "out", "output_path": "/nix/store/w3p5316vhdi7q9cab1nqq9971rgh9cw5-nixos-system-kirk-24.05.20240102.bd645e8"}], "name": "nixos-system-kirk-24.05.20240102.bd645e8", "parsed_name": {"name": "nixos-system-kirk", "version": "24.05.20240102.bd645e8"}, "nixpkgs_metadata": {"description": "", "pname": "False", "version": "", "broken": false, "homepage": "", "licenses": null}, "build_inputs": []}
{"attribute_path": "picard.out", "derivation_path": "/nix/store/vjqbpm0l1373fbrmymgc9kjzwz986wmc-nixos-system-picard-24.05.20240102.bd645e8.drv", "output_path": "/nix/store/sb1g05fvdfbbqhwpq6qkh33hycplyn07-nixos-system-picard-24.05.20240102.bd645e8", "outputs": [{"name": "out", "output_path": "/nix/store/sb1g05fvdfbbqhwpq6qkh33hycplyn07-nixos-system-picard-24.05.20240102.bd645e8"}], "name": "nixos-system-picard-24.05.20240102.bd645e8", "parsed_name": {"name": "nixos-system-picard", "version": "24.05.20240102.bd645e8"}, "nixpkgs_metadata": {"description": "", "pname": "False", "version": "", "broken": false, "homepage": "", "licenses": null}, "build_inputs": []}

Why only 2 derivations? Shouldn't nixtract list the closure recursively?

@GuillaumeDesforges

@aciceri
Copy link
Author

aciceri commented Jan 5, 2024

Just for adding a bit of context: we wrote an Hercules CI effect that pushes arbitrary derivations to self-hosted attic caches and I was considering nixtract to get the list of all derivations in between outputs of a given flake.

@GuillaumeDesforges
Copy link
Collaborator

GuillaumeDesforges commented Jan 11, 2024

That's a good point. I've made a feature request that we can add to the roadmap: #21
Before jumping to the implementation, can we first discuss the UX in the issue? 🙂
Thanks a lot!

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

Successfully merging this pull request may close these issues.

2 participants