aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/path-with-outputs.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-05-03 15:38:47 +0200
committerGitHub <noreply@github.com>2022-05-03 15:38:47 +0200
commit9489b4b7ef73ab20e8f49213d8711ca56b59107e (patch)
treed1484046123f178724d86e265b49425e2c90628b /src/libstore/path-with-outputs.hh
parent404c222444b4c8c60148ccf890cd41611f26b0a0 (diff)
parenta3c6c5b1c745a72a6a46bdf1a1de7a51a53f76b0 (diff)
Merge pull request #6449 from edolstra/outputs-spec
Allow selecting derivation outputs
Diffstat (limited to 'src/libstore/path-with-outputs.hh')
-rw-r--r--src/libstore/path-with-outputs.hh22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libstore/path-with-outputs.hh b/src/libstore/path-with-outputs.hh
index 4c4023dcb..0cb5eb223 100644
--- a/src/libstore/path-with-outputs.hh
+++ b/src/libstore/path-with-outputs.hh
@@ -4,6 +4,7 @@
#include "path.hh"
#include "derived-path.hh"
+#include "nlohmann/json_fwd.hpp"
namespace nix {
@@ -32,4 +33,25 @@ StorePathWithOutputs parsePathWithOutputs(const Store & store, std::string_view
StorePathWithOutputs followLinksToStorePathWithOutputs(const Store & store, std::string_view pathWithOutputs);
+typedef std::set<std::string> OutputNames;
+
+struct AllOutputs {
+ bool operator < (const AllOutputs & _) const { return false; }
+};
+
+struct DefaultOutputs {
+ bool operator < (const DefaultOutputs & _) const { return false; }
+};
+
+typedef std::variant<DefaultOutputs, AllOutputs, OutputNames> OutputsSpec;
+
+/* Parse a string of the form 'prefix^output1,...outputN' or
+ 'prefix^*', returning the prefix and the outputs spec. */
+std::pair<std::string, OutputsSpec> parseOutputsSpec(const std::string & s);
+
+std::string printOutputsSpec(const OutputsSpec & outputsSpec);
+
+void to_json(nlohmann::json &, const OutputsSpec &);
+void from_json(const nlohmann::json &, OutputsSpec &);
+
}