NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.86k stars 1.52k forks source link

`PackageInfo::queryOutputs` should not trip up on placeholders #11885

Open Ericson2314 opened 1 week ago

Ericson2314 commented 1 week ago

Is your feature request related to a problem? Please describe.

Currently when we try to get outputs (based on a bool parameter which perhaps we can get rid of with this), we get:

 error: derivation 'caDependingOnCA' does not have valid outputs:
 error: while evaluating the output path of a derivation at <nix/derivation-internal.nix>:19:9:

   18|       value = commonAttrs // {
   19|         outPath = builtins.getAttr outputName strict;\n
     |         ^
   20|         drvPath = strict.drvPath;
error: path '/0rmq7bvk2raajd310spvd416f2jajrabcg6ar706gjbd6b8nmvks' is not in the Nix store

or so.

This is because that is a placeholder, not a read store path.

Describe the solution you'd like

We should first check if it is a placeholder, and then the path to be std::nullopt accordingly.

Describe alternatives you've considered

Arguably this whole function is a misguided mess considering https://github.com/NixOS/nix/issues/6507 though.

Additional context

Currently breaking https://github.com/NixOS/hydra/pull/1421

CC @Mic92

Priorities

Add :+1: to issues you find important.