aboutsummaryrefslogtreecommitdiff
path: root/src/nix/profile.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-01-18 23:08:58 +0100
committerEelco Dolstra <edolstra@gmail.com>2021-01-18 23:08:58 +0100
commitbc90252cec9af05b897cf209012d44a9b20ea251 (patch)
tree15005ec8c8f2208ca3b57553e86698849ba82f92 /src/nix/profile.cc
parent555940f0659e95de7f890ede48e2faba096b3d6d (diff)
nix profile install: Support installing non-flakes
Fixes #4458.
Diffstat (limited to 'src/nix/profile.cc')
-rw-r--r--src/nix/profile.cc24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/nix/profile.cc b/src/nix/profile.cc
index ca95817d0..765d6866e 100644
--- a/src/nix/profile.cc
+++ b/src/nix/profile.cc
@@ -252,8 +252,28 @@ struct CmdProfileInstall : InstallablesCommand, MixDefaultProfile
pathsToBuild.push_back({drv.drvPath, StringSet{"out"}}); // FIXME
manifest.elements.emplace_back(std::move(element));
- } else
- throw UnimplementedError("'nix profile install' does not support argument '%s'", installable->what());
+ } else {
+ auto buildables = build(store, Realise::Outputs, {installable}, bmNormal);
+
+ for (auto & buildable : buildables) {
+ ProfileElement element;
+
+ std::visit(overloaded {
+ [&](BuildableOpaque bo) {
+ pathsToBuild.push_back({bo.path, {}});
+ element.storePaths.insert(bo.path);
+ },
+ [&](BuildableFromDrv bfd) {
+ for (auto & output : store->queryDerivationOutputMap(bfd.drvPath)) {
+ pathsToBuild.push_back({bfd.drvPath, {output.first}});
+ element.storePaths.insert(output.second);
+ }
+ },
+ }, buildable);
+
+ manifest.elements.emplace_back(std::move(element));
+ }
+ }
}
store->buildPaths(pathsToBuild);