aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-10 11:27:19 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2023-01-10 11:27:19 -0500
commitda64f026dd7b12d72ffbc15752e8b95707fa1f9f (patch)
tree80c63ff92aba1820e0f70845efcba0a190ef4838 /src/nix
parent1c98daf6e8bdf771ed3b17c947384fef4ed8d006 (diff)
Make clear that `StorePathWithOutputs` is a deprecated type
- Add a comment - Put `OutputsSpec` in a different header (First part of #6815) - Make a few stray uses of it in new code use `DerivedPath` instead.
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/app.cc23
-rw-r--r--src/nix/develop.cc2
-rw-r--r--src/nix/flake.cc2
3 files changed, 20 insertions, 7 deletions
diff --git a/src/nix/app.cc b/src/nix/app.cc
index a8d7e115b..fb149042c 100644
--- a/src/nix/app.cc
+++ b/src/nix/app.cc
@@ -79,9 +79,19 @@ UnresolvedApp Installable::toApp(EvalState & state)
if (type == "app") {
auto [program, context] = cursor->getAttr("program")->getStringWithContext();
- std::vector<StorePathWithOutputs> context2;
- for (auto & [path, name] : context)
- context2.push_back({path, {name}});
+ std::vector<DerivedPath> context2;
+ for (auto & [path, name] : context) {
+ context2.push_back(name != "" || path.isDerivation()
+ ? (DerivedPath) DerivedPath::Built {
+ .drvPath = path,
+ .outputs = name != ""
+ ? StringSet { name }
+ : StringSet { },
+ }
+ : (DerivedPath) DerivedPath::Opaque {
+ .path = path,
+ });
+ }
return UnresolvedApp{App {
.context = std::move(context2),
@@ -105,7 +115,10 @@ UnresolvedApp Installable::toApp(EvalState & state)
: DrvName(name).name;
auto program = outPath + "/bin/" + mainProgram;
return UnresolvedApp { App {
- .context = { { drvPath, {outputName} } },
+ .context = { DerivedPath::Built {
+ .drvPath = drvPath,
+ .outputs = {outputName},
+ } },
.program = program,
}};
}
@@ -123,7 +136,7 @@ App UnresolvedApp::resolve(ref<Store> evalStore, ref<Store> store)
for (auto & ctxElt : unresolved.context)
installableContext.push_back(
- std::make_shared<InstallableDerivedPath>(store, ctxElt.toDerivedPath()));
+ std::make_shared<InstallableDerivedPath>(store, ctxElt));
auto builtContext = Installable::build(evalStore, store, Realise::Outputs, installableContext);
res.program = resolveString(*store, unresolved.program, builtContext);
diff --git a/src/nix/develop.cc b/src/nix/develop.cc
index 1d90d1dac..6aa675386 100644
--- a/src/nix/develop.cc
+++ b/src/nix/develop.cc
@@ -3,7 +3,7 @@
#include "common-args.hh"
#include "shared.hh"
#include "store-api.hh"
-#include "path-with-outputs.hh"
+#include "outputs-spec.hh"
#include "derivations.hh"
#include "progress-bar.hh"
#include "run.hh"
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index 9b4cdf35a..bb020d51e 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -7,7 +7,7 @@
#include "get-drvs.hh"
#include "store-api.hh"
#include "derivations.hh"
-#include "path-with-outputs.hh"
+#include "outputs-spec.hh"
#include "attr-path.hh"
#include "fetchers.hh"
#include "registry.hh"