nix-super/src/libcmd/common-eval-args.hh

44 lines
915 B
C++
Raw Normal View History

#pragma once
///@file
#include "args.hh"
#include "canon-path.hh"
2023-04-28 17:57:37 +03:00
#include "common-args.hh"
#include "search-path.hh"
2024-03-04 13:49:32 +02:00
#include <filesystem>
namespace nix {
class Store;
class EvalState;
class Bindings;
struct SourcePath;
2023-04-28 17:57:37 +03:00
struct MixEvalArgs : virtual Args, virtual MixRepair
{
static constexpr auto category = "Common evaluation options";
MixEvalArgs();
Bindings * getAutoArgs(EvalState & state);
SearchPath searchPath;
std::optional<std::string> evalStoreUrl;
private:
2024-03-01 15:14:14 +02:00
struct AutoArgExpr { std::string expr; };
struct AutoArgString { std::string s; };
struct AutoArgFile { std::filesystem::path path; };
struct AutoArgStdin { };
2024-03-01 15:14:14 +02:00
using AutoArg = std::variant<AutoArgExpr, AutoArgString, AutoArgFile, AutoArgStdin>;
2024-03-01 15:14:14 +02:00
std::map<std::string, AutoArg> autoArgs;
};
SourcePath lookupFileArg(EvalState & state, std::string_view s, const Path * baseDir = nullptr);
}