I know little about nix, but I am work on an cardano project, which fully base on nix.
When I run nix-shell
, I’m blinder, not aware what it done for me.
For now, I want to know what packages are compiled by download source code, what package are taken from the binary cached.
Or even more, I expect it print the full compiling log.
Thanks for any suggestion.
Nix doesn’t really have a precisely defined concept of a “package”, only a “derivation”. Plenty of “derivations” aren’t exactly what you would normally consider “packages” in another package manager. They may be single config files, or wrapper scripts for binaries in a different derivation, or just a bunch of symlinks.
nix-shell
should print out what derivations it is downloading from the cache, and what derivations it’s building, as it goes along, but it doesn’t print out anything for derivations that already exist locally.
You can find out dependencies of a derivation you have in your local nix store with nix-store --query
commands (check the man page for specifics), however the way nix-shell
works means that there isn’t a single derivation representing the environment it creates, unfortunately.
The best way to understand what nix-shell
is doing in a given case may just be to look at the shell.nix
and understand what environment it would create.
1 Like
Thanks for your help.
I get it. There are too many “derivation” for a single shell.nix and the dependent hierarchy layer can be deep enough, that cause it hard to trace every .drv file that nix-shell
involved.
So reading the shell.nix is the only way to get a global view of what nix-shell
command does.