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

Add support for flake syntax, like nixpkgs#hello #27

Closed
bew opened this issue Dec 18, 2021 · 3 comments
Closed

Add support for flake syntax, like nixpkgs#hello #27

bew opened this issue Dec 18, 2021 · 3 comments

Comments

@bew
Copy link

bew commented Dec 18, 2021

Hello, first of all: thanks for this tool, it's really nice to get some insight on a derivation :)

It's been some time that I switched completely to flakes, and recently I tried to run:
nix run unstable#python3.pkgs.ipython
which downloaded a lot of packages before working.

I wanted to get some insight with nix-tree and intuitively tried to do:
nix-tree unstable#python3.pkgs.ipython
⚠️ but that didn't work, basically saying that it's not a store path.

Would it be possible to add support for that?

@utdemir
Copy link
Owner

utdemir commented Dec 19, 2021

Thanks for the issue!

Yes, you're right that nix-tree currently only works on store paths. But it should be easy to make it work with flakes too, and it makes sense to me to support them.

I will try to have a look at this next weekend (unless someone else beats me to it, of course :))


Little bit of technical detail, to future me or anyone else who'd like to work on it:

For every parameter, nix-tree runs (approximately)

nix path-info --recursive --json --extra-experimental-features nix-command <given path>

And I just checked, and that command also happily accepts flake inputs. The reason nix-tree currently doesn't accept that is simply because it only expects file paths from command line. So making it accept flakes should simply be an exercise of being not as strict when passing command line parameters.

@utdemir
Copy link
Owner

utdemir commented Dec 25, 2021

I just added 057dd63 to support flake references. It now simply passes the arguments to nix path-info, and not tries to interpret them as store paths.

It still requires the store paths to be present on Nix store, which is also the behaviour of nix path-info.

Let me know if it works for you, or feel free to reopen this issue if it doesn't :).

PS: You can try it on the latest version via:

nix run github:utdemir/nix-tree -- --derivation nixpkgs#python3.pkgs.ipython 

I'll cut a release after you try this & I fix a few more issues.

Thanks again!

@utdemir utdemir closed this as completed Dec 25, 2021
@bew
Copy link
Author

bew commented Dec 25, 2021

Thanks a lot, tested it and it works well 👍

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