1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-12 03:51:04 +01:00

Pull out Buildable into its own file/header in libnixstore

This commit is contained in:
John Ericson 2021-03-01 05:48:01 +00:00
parent a07dc7e0d9
commit f7d9f7c338
4 changed files with 68 additions and 46 deletions

34
src/libstore/buildable.hh Normal file
View file

@ -0,0 +1,34 @@
#pragma once
#include "util.hh"
#include "path.hh"
#include <optional>
#include <nlohmann/json_fwd.hpp>
namespace nix {
class Store;
struct BuildableOpaque {
StorePath path;
nlohmann::json toJSON(ref<Store> store) const;
};
struct BuildableFromDrv {
StorePath drvPath;
std::map<std::string, std::optional<StorePath>> outputs;
nlohmann::json toJSON(ref<Store> store) const;
};
typedef std::variant<
BuildableOpaque,
BuildableFromDrv
> Buildable;
typedef std::vector<Buildable> Buildables;
nlohmann::json buildablesToJSON(const Buildables & buildables, ref<Store> store);
}