2017-10-24 13:45:11 +03:00
|
|
|
#pragma once
|
2023-04-01 06:18:41 +03:00
|
|
|
///@file
|
2017-10-24 13:45:11 +03:00
|
|
|
|
|
|
|
#include "args.hh"
|
2023-05-12 20:42:49 +03:00
|
|
|
#include "canon-path.hh"
|
2023-04-28 17:57:37 +03:00
|
|
|
#include "common-args.hh"
|
2023-06-23 20:51:25 +03:00
|
|
|
#include "search-path.hh"
|
2017-10-24 13:45:11 +03:00
|
|
|
|
2024-03-04 13:49:32 +02:00
|
|
|
#include <filesystem>
|
|
|
|
|
2017-10-24 13:45:11 +03:00
|
|
|
namespace nix {
|
|
|
|
|
|
|
|
class Store;
|
|
|
|
class EvalState;
|
2017-11-01 22:32:30 +02:00
|
|
|
class Bindings;
|
2023-04-06 14:15:50 +03:00
|
|
|
struct SourcePath;
|
2017-10-24 13:45:11 +03:00
|
|
|
|
2023-04-28 17:57:37 +03:00
|
|
|
struct MixEvalArgs : virtual Args, virtual MixRepair
|
2017-10-24 13:45:11 +03:00
|
|
|
{
|
2022-10-12 16:09:00 +03:00
|
|
|
static constexpr auto category = "Common evaluation options";
|
|
|
|
|
2017-10-24 13:45:11 +03:00
|
|
|
MixEvalArgs();
|
|
|
|
|
|
|
|
Bindings * getAutoArgs(EvalState & state);
|
|
|
|
|
2023-06-23 20:51:25 +03:00
|
|
|
SearchPath searchPath;
|
2017-10-24 13:45:11 +03:00
|
|
|
|
2021-07-15 15:28:33 +03:00
|
|
|
std::optional<std::string> evalStoreUrl;
|
2017-10-24 13:45:11 +03:00
|
|
|
|
2021-07-15 15:28:33 +03:00
|
|
|
private:
|
2024-03-01 15:14:14 +02:00
|
|
|
struct AutoArgExpr { std::string expr; };
|
|
|
|
struct AutoArgString { std::string s; };
|
2024-03-01 15:35:27 +02:00
|
|
|
struct AutoArgFile { std::filesystem::path path; };
|
2024-03-01 15:39:42 +02:00
|
|
|
struct AutoArgStdin { };
|
2024-03-01 15:14:14 +02:00
|
|
|
|
2024-03-01 15:39:42 +02:00
|
|
|
using AutoArg = std::variant<AutoArgExpr, AutoArgString, AutoArgFile, AutoArgStdin>;
|
2024-03-01 15:14:14 +02:00
|
|
|
|
|
|
|
std::map<std::string, AutoArg> autoArgs;
|
2017-10-24 13:45:11 +03:00
|
|
|
};
|
|
|
|
|
2024-02-06 23:23:58 +02:00
|
|
|
SourcePath lookupFileArg(EvalState & state, std::string_view s, const Path * baseDir = nullptr);
|
2017-10-24 13:45:11 +03:00
|
|
|
|
|
|
|
}
|