1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-10 12:36:01 +01:00

Make getDstStore() a virtual method in StoreCommand

This commit is contained in:
Eelco Dolstra 2024-10-08 15:36:21 +02:00
parent 76f75e7691
commit 43ad8c5eb2
6 changed files with 26 additions and 21 deletions

View file

@ -246,21 +246,17 @@ MixProfile::MixProfile()
});
}
void MixProfile::updateProfile(
const StorePath & storePath,
ref<Store> store_)
void MixProfile::updateProfile(const StorePath & storePath)
{
if (!profile) return;
auto store = store_.dynamic_pointer_cast<LocalFSStore>();
auto store = getDstStore().dynamic_pointer_cast<LocalFSStore>();
if (!store) throw Error("'--profile' is not supported for this Nix store");
auto profile2 = absPath(*profile);
switchLink(profile2,
createGeneration(*store, profile2, storePath));
}
void MixProfile::updateProfile(
const BuiltPaths & buildables,
ref<Store> store)
void MixProfile::updateProfile(const BuiltPaths & buildables)
{
if (!profile) return;
@ -282,7 +278,7 @@ void MixProfile::updateProfile(
if (result.size() != 1)
throw UsageError("'--profile' requires that the arguments produce a single store path, but there are %d", result.size());
updateProfile(result[0], store);
updateProfile(result[0]);
}
MixDefaultProfile::MixDefaultProfile()