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

47 lines
1 KiB
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);
LookupPath lookupPath;
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;
};
2024-04-19 19:54:31 +03:00
/**
* @param baseDir Optional [base directory](https://nixos.org/manual/nix/unstable/glossary#gloss-base-directory)
*/
SourcePath lookupFileArg(EvalState & state, std::string_view s, const Path * baseDir = nullptr);
}