aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-02-03 11:21:47 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-02-03 11:26:39 -0500
commit45fa297e4052acef962d9d124241e7abd02f58af (patch)
treedbcf2f8e8023244acc5b7595c44b026d18ee4162 /src/nix
parentdbe0748f970a86911aae2cb6b603dfb8b541f8d9 (diff)
Factor out `InstallableStorePath` to its own file, dedup
`nix app` had something called `InstallableDerivedPath` which is actually the same thing. We go with the later's name because it has become more correct. I originally did this change (more hurriedly) as part of #6225 --- a mini store-only Nix and a full Nix need to share this code. In the first RFC meeting for https://github.com/NixOS/rfcs/pull/134 we discussed how some splitting of the massive `installables.cc` could begin prior, as that is a good thing anyways. (@edolstra's words, not mine!) This would be one such PR.
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/app.cc27
1 files changed, 2 insertions, 25 deletions
diff --git a/src/nix/app.cc b/src/nix/app.cc
index 08cd0ccd4..5cd65136f 100644
--- a/src/nix/app.cc
+++ b/src/nix/app.cc
@@ -1,4 +1,5 @@
#include "installables.hh"
+#include "installable-derived-path.hh"
#include "store-api.hh"
#include "eval-inline.hh"
#include "eval-cache.hh"
@@ -8,30 +9,6 @@
namespace nix {
-struct InstallableDerivedPath : Installable
-{
- ref<Store> store;
- const DerivedPath derivedPath;
-
- InstallableDerivedPath(ref<Store> store, const DerivedPath & derivedPath)
- : store(store)
- , derivedPath(derivedPath)
- {
- }
-
- std::string what() const override { return derivedPath.to_string(*store); }
-
- DerivedPathsWithInfo toDerivedPaths() override
- {
- return {{derivedPath}};
- }
-
- std::optional<StorePath> getStorePath() override
- {
- return std::nullopt;
- }
-};
-
/**
* Return the rewrites that are needed to resolve a string whose context is
* included in `dependencies`.
@@ -146,7 +123,7 @@ App UnresolvedApp::resolve(ref<Store> evalStore, ref<Store> store)
for (auto & ctxElt : unresolved.context)
installableContext.push_back(
- std::make_shared<InstallableDerivedPath>(store, ctxElt));
+ std::make_shared<InstallableDerivedPath>(store, DerivedPath { ctxElt }));
auto builtContext = Installable::build(evalStore, store, Realise::Outputs, installableContext);
res.program = resolveString(*store, unresolved.program, builtContext);