What does nix-shell -A do exactly?

Good day,

I’m following the Home Manager installation instructions and at certain point of time the asks to run

nix-shell '<home-manager>' -A install

My understanding is that nix-shell creates isolated Nix environment, so how come it can “install” something that lives beyond & outside the shell created?

-A is short for --attr, which you can use to specify an attribute you want to have the package for.

So --attr install will give you a shell for building the install attribute. Though this particular attribute is basically just a big shellHook running the actual work outside of the build sandbox, but in your created environment.

OK. I think I understand it better now. Will read it again after I’ll sleep on it.

Thank you for the quick answer!