1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 06:31:14 +02:00

Make nix-shell support content-addressed derivations

Resolve the derivation before trying to load its environment −
essentially reproducing what the build loop does − so that we can
effectively access our dependencies (and not just their placeholders).

Fix #4821
This commit is contained in:
regnat 2021-05-20 13:55:00 +02:00
parent 8e6ee1b9e9
commit 56605b4688
5 changed files with 42 additions and 6 deletions

View file

@ -387,6 +387,13 @@ static void main_nix_build(int argc, char * * argv)
if (dryRun) return;
if (settings.isExperimentalFeatureEnabled("ca-derivations")) {
auto resolvedDrv = drv.tryResolve(*store);
if (!resolvedDrv)
throw Error("unable to resolve the derivation '%s'. nix-shell cant continue", drvInfo.queryDrvPath());
drv = *resolvedDrv;
}
// Set the environment.
auto env = getEnv();