nixd
Toggle main menu visibility
Loading...
Searching...
No Matches
nixd
lib
Eval
Launch.cpp
Go to the documentation of this file.
1
#include "
nixd/Eval/Launch.h
"
2
#include "
nixd/CommandLine/Options.h
"
3
4
#include <llvm/Support/CommandLine.h>
5
6
using namespace
llvm::cl;
7
using namespace
nixd
;
8
9
namespace
{
10
11
#define NULL_DEVICE "/dev/null"
12
13
opt<std::string> OptionWorkerStderr{
14
"option-worker-stderr"
, desc(
"Directory to write options worker stderr"
),
15
cat(
NixdCategory
), init(
NULL_DEVICE
)};
16
17
opt<std::string> NixpkgsWorkerStderr{
18
"nixpkgs-worker-stderr"
,
19
desc(
"Writable file path for nixpkgs worker stderr (debugging)"
),
20
cat(
NixdCategory
), init(
NULL_DEVICE
)};
21
22
}
// namespace
23
24
void
nixd::startAttrSetEval
(
const
std::string &Name,
25
std::unique_ptr<AttrSetClientProc> &Worker) {
26
Worker = std::make_unique<AttrSetClientProc>([&Name]() {
27
freopen(Name.c_str(),
"w"
, stderr);
28
return
execl(
AttrSetClient::getExe
(),
"nixd-attrset-eval"
,
nullptr
);
29
});
30
}
31
32
void
nixd::startNixpkgs
(std::unique_ptr<AttrSetClientProc> &NixpkgsEval) {
33
startAttrSetEval
(NixpkgsWorkerStderr, NixpkgsEval);
34
}
35
36
void
nixd::startOption
(
const
std::string &Name,
37
std::unique_ptr<AttrSetClientProc> &Worker) {
38
std::string NewName =
NULL_DEVICE
;
39
if
(OptionWorkerStderr.getNumOccurrences())
40
NewName = OptionWorkerStderr.getValue() +
"/"
+ Name;
41
startAttrSetEval
(NewName, Worker);
42
}
NULL_DEVICE
#define NULL_DEVICE
Definition
Launch.cpp:11
Launch.h
Options.h
nixd::AttrSetClient::getExe
static const char * getExe()
Definition
AttrSetClient.cpp:26
nixd
Definition
CommandLine/Configuration.h:9
nixd::NixdCategory
llvm::cl::OptionCategory NixdCategory
nixd::startAttrSetEval
void startAttrSetEval(const std::string &Name, std::unique_ptr< AttrSetClientProc > &Worker)
Definition
Launch.cpp:24
nixd::startOption
void startOption(const std::string &Name, std::unique_ptr< AttrSetClientProc > &Worker)
Definition
Launch.cpp:36
nixd::startNixpkgs
void startNixpkgs(std::unique_ptr< AttrSetClientProc > &NixpkgsEval)
Definition
Launch.cpp:32
Generated by
1.17.0