libcmd: fix activatable attrpath rewriting

This commit is contained in:
Max Headroom 2023-05-04 22:12:54 +02:00
parent a6bf675bc8
commit 37f9639938

View file

@ -9,11 +9,10 @@ ActivatableCommand::ActivatableCommand(std::string activationPackageAttrPath)
{ } { }
void ActivatableCommand::run(ref<Store> store, ref<Installable> installable) { void ActivatableCommand::run(ref<Store> store, ref<Installable> installable) {
auto _installable = installable;
auto installableFlake = installable.dynamic_pointer_cast<InstallableFlake>();; auto installableFlake = installable.dynamic_pointer_cast<InstallableFlake>();;
if (installableFlake) { if (installableFlake) {
auto fragment = *installableFlake->attrPaths.begin(); auto fragment = *installableFlake->attrPaths.begin();
auto _installable = std::make_shared<InstallableFlake>( auto _installable = make_ref<InstallableFlake>(
this, this,
getEvalState(), getEvalState(),
std::move(installableFlake->flakeRef), std::move(installableFlake->flakeRef),
@ -23,8 +22,10 @@ void ActivatableCommand::run(ref<Store> store, ref<Installable> installable) {
getDefaultFlakeAttrPathPrefixes(), getDefaultFlakeAttrPathPrefixes(),
installableFlake->lockFlags installableFlake->lockFlags
); );
}
runActivatable(store, _installable); runActivatable(store, _installable);
} else {
runActivatable(store, installable);
}
} }
StorePath ActivatableCommand::buildActivatable(nix::ref<nix::Store> store, ref<Installable> installable, bool dryRun) { StorePath ActivatableCommand::buildActivatable(nix::ref<nix::Store> store, ref<Installable> installable, bool dryRun) {