1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/// @file WASM stubs for symbols from files excluded from the WASM evaluator build:
/// platform.cc, async-io.cc, compute-levels.cc.

#include "lix/libutil/async-io.hh"
#include "lix/libutil/error.hh"
#include "lix/libutil/result.hh"
#include "lix/libstore/store-api.hh"

#include <kj/async.h>

namespace nix {

// ---------------------------------------------------------------------------
// getMaxCPU() — from compute-levels.cc (x86-only, excluded from WASM)
// ---------------------------------------------------------------------------
unsigned int getMaxCPU()
{
    return 1;
}

// ---------------------------------------------------------------------------
// AsyncGeneratorInputStream::read — defined in async-io.cc (excluded from WASM)
// ---------------------------------------------------------------------------
kj::Promise<Result<std::optional<size_t>>> AsyncGeneratorInputStream::read(void *, size_t)
try {
    throw Error("AsyncGeneratorInputStream::read not available in WASM");
} catch (...) {
    return {result::current_exception()};
}

// ---------------------------------------------------------------------------
// Store::repairPath — default impl in misc.cc references local-store (excluded)
// ---------------------------------------------------------------------------
kj::Promise<Result<void>> Store::repairPath(const StorePath &)
try {
    throw Error("Store::repairPath not available in WASM");
} catch (...) {
    return {result::current_exception()};
}

} // namespace nix