aboutsummaryrefslogtreecommitdiff
path: root/src/libcmd/installable-derived-path.hh
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/libcmd/installable-derived-path.hh
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/libcmd/installable-derived-path.hh')
-rw-r--r--src/libcmd/installable-derived-path.hh28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/libcmd/installable-derived-path.hh b/src/libcmd/installable-derived-path.hh
new file mode 100644
index 000000000..042878b91
--- /dev/null
+++ b/src/libcmd/installable-derived-path.hh
@@ -0,0 +1,28 @@
+#pragma once
+
+#include "installables.hh"
+
+namespace nix {
+
+struct InstallableDerivedPath : Installable
+{
+ ref<Store> store;
+ DerivedPath derivedPath;
+
+ InstallableDerivedPath(ref<Store> store, DerivedPath && derivedPath)
+ : store(store), derivedPath(std::move(derivedPath))
+ { }
+
+ std::string what() const override;
+
+ DerivedPathsWithInfo toDerivedPaths() override;
+
+ std::optional<StorePath> getStorePath() override;
+
+ static InstallableDerivedPath parse(
+ ref<Store> store,
+ std::string_view prefix,
+ ExtendedOutputsSpec extendedOutputsSpec);
+};
+
+}