I'm trying to understand how package managers, specifically Nix, ensure that a package can be installed.
I know that Nix packages declare all of their dependencies explicitly. But can Nix provide a guarantee, or at least a high level of certainty, that a package installation will succeed before it starts? If so, how does it do this? If not, why not, and is there any way to get a similar level of certainty about package installations?
Is there a command to check compatibility of a package before actually running the installation, like a formally verified operating system?