mirror of
https://github.com/NixOS/nix.git
synced 2025-11-28 13:11:00 +01:00
Merge pull request #14641 from obsidiansystems/simplify-nix-develop
Simplify `nix develop` "gathering derivation environment"
This commit is contained in:
commit
423e732b22
3 changed files with 35 additions and 20 deletions
|
|
@ -272,26 +272,24 @@ static StorePath getDerivationEnvironment(ref<Store> store, ref<Store> evalStore
|
|||
drv.name += "-env";
|
||||
drv.env.emplace("name", drv.name);
|
||||
drv.inputSrcs.insert(std::move(getEnvShPath));
|
||||
if (experimentalFeatureSettings.isEnabled(Xp::CaDerivations)) {
|
||||
for (auto & output : drv.outputs) {
|
||||
output.second = DerivationOutput::Deferred{}, drv.env[output.first] = hashPlaceholder(output.first);
|
||||
}
|
||||
} else {
|
||||
for (auto & output : drv.outputs) {
|
||||
output.second = DerivationOutput::Deferred{};
|
||||
drv.env[output.first] = "";
|
||||
}
|
||||
auto hashesModulo = hashDerivationModulo(*evalStore, drv, true);
|
||||
|
||||
for (auto & output : drv.outputs) {
|
||||
Hash h = hashesModulo.hashes.at(output.first);
|
||||
auto outPath = store->makeOutputPath(output.first, h, drv.name);
|
||||
output.second = DerivationOutput::InputAddressed{
|
||||
.path = outPath,
|
||||
};
|
||||
drv.env[output.first] = store->printStorePath(outPath);
|
||||
}
|
||||
for (auto & [outputName, output] : drv.outputs) {
|
||||
std::visit(
|
||||
overloaded{
|
||||
[&](const DerivationOutput::InputAddressed &) {
|
||||
output = DerivationOutput::Deferred{};
|
||||
drv.env[outputName] = "";
|
||||
},
|
||||
[&](const DerivationOutput::CAFixed &) {
|
||||
output = DerivationOutput::Deferred{};
|
||||
drv.env[outputName] = "";
|
||||
},
|
||||
[&](const auto &) {
|
||||
// Do nothing for other types (CAFloating, Deferred, Impure)
|
||||
},
|
||||
},
|
||||
output.raw);
|
||||
}
|
||||
drv.fillInOutputPaths(*evalStore);
|
||||
|
||||
auto shellDrvPath = writeDerivation(*evalStore, drv);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue