From 1e3a9033b7010c3b49c61c05ec93ba1ba6a61c97 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 5 May 2021 16:33:05 -0500 Subject: [PATCH] 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. --- src/nix/profile.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nix/profile.cc b/src/nix/profile.cc index 667904cd2..e511c4c3e 100644 --- a/src/nix/profile.cc +++ b/src/nix/profile.cc @@ -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}}); } }