1{
2 lib,
3 stdenv,
4 mkMesonLibrary,
5
6 bison,
7 flex,
8 cmake, # for resolving toml11 dep
9
10 nix-util,
11 nix-store,
12 nix-fetchers,
13 boost,
14 boehmgc,
15 nlohmann_json,
16 toml11,
17
18 # Configuration Options
19
20 version,
21
22 # Whether to use garbage collection for the Nix language evaluator.
23 #
24 # If it is disabled, we just leak memory, but this is not as bad as it
25 # sounds so long as evaluation just takes places within short-lived
26 # processes. (When the process exits, the memory is reclaimed; it is
27 # only leaked *within* the process.)
28 #
29 # Temporarily disabled on Windows because the `GC_throw_bad_alloc`
30 # symbol is missing during linking.
31 enableGC ? !stdenv.hostPlatform.isWindows,
32}:
33
34mkMesonLibrary (finalAttrs: {
35 pname = "nix-expr";
36 inherit version;
37
38 workDir = ./.;
39
40 nativeBuildInputs = [
41 bison
42 flex
43 cmake
44 ];
45
46 buildInputs = [
47 toml11
48 ];
49
50 propagatedBuildInputs = [
51 nix-util
52 nix-store
53 nix-fetchers
54 ]
55 ++ finalAttrs.passthru.externalPropagatedBuildInputs;
56
57 # Hack for sake of the dev shell
58 passthru.externalPropagatedBuildInputs = [
59 boost
60 nlohmann_json
61 ]
62 ++ lib.optional enableGC boehmgc;
63
64 mesonFlags = [
65 (lib.mesonEnable "gc" enableGC)
66 ];
67
68 meta = {
69 platforms = lib.platforms.unix ++ lib.platforms.windows;
70 };
71
72})