Use derivation output name from toDerivation

This was previously done in https://github.com/NixOS/nix/pull/4515 but
got clobbered away in https://github.com/NixOS/nix/pull/4594.

--------------------------------------------------------------------------------

This fixes an issue where derivations with a primary output that is
not "out" would fail with:

$ nix profile install nixpkgs#sqlite
error: opening directory '/nix/store/2a2ydlgyydly5czcc8lg12n6qqkfz863-sqlite-3.34.1-bin': No such file or directory

This happens because while derivations produce every output when
built, you might not have them if you didn't build the derivation
yourself (for instance, the store path was fetch from a binary cache).
This uses outputName provided from DerivationInfo which appears to
match the first output of the derivation.
This commit is contained in:
Matthew Bauer 2021-05-05 16:33:05 -05:00
parent fe3a10a9b2
commit 1e3a9033b7

View file

@ -426,7 +426,7 @@ struct CmdProfileUpgrade : virtual SourceExprCommand, MixDefaultProfile, MixProf
attrPath,
};
pathsToBuild.push_back(DerivedPath::Built{drv.drvPath, {"out"}}); // FIXME
pathsToBuild.push_back(DerivedPath::Built{drv.drvPath, {drv.outputName}});
}
}