diff options
author | regnat <rg@regnat.ovh> | 2021-05-20 13:55:00 +0200 |
---|---|---|
committer | regnat <rg@regnat.ovh> | 2021-06-11 13:32:49 +0200 |
commit | 56605b468868b834e44a9700907b734428cb120a (patch) | |
tree | b0117083df01f50aafd8186cc048082721e99ef1 /src | |
parent | 8e6ee1b9e924fbbbeb5594eb89e7a570f36ab6e1 (diff) |
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
Diffstat (limited to 'src')
-rwxr-xr-x | src/nix-build/nix-build.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nix-build/nix-build.cc b/src/nix-build/nix-build.cc index 9acbedda2..05eb7e234 100755 --- a/src/nix-build/nix-build.cc +++ b/src/nix-build/nix-build.cc @@ -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 can’t continue", drvInfo.queryDrvPath()); + drv = *resolvedDrv; + } + // Set the environment. auto env = getEnv(); |