summaryrefslogtreecommitdiff
path: root/pkgs/tools/package-management/nix/modular/src/libexpr/package.nix
blob: 5ff60bbf9c1ba0425acc2ba0f6eaf315debdad1c (about) (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{
  lib,
  stdenv,
  mkMesonLibrary,

  bison,
  flex,
  cmake, # for resolving toml11 dep

  nix-util,
  nix-store,
  nix-fetchers,
  boost,
  boehmgc,
  nlohmann_json,
  toml11,

  # Configuration Options

  version,

  # Whether to use garbage collection for the Nix language evaluator.
  #
  # If it is disabled, we just leak memory, but this is not as bad as it
  # sounds so long as evaluation just takes places within short-lived
  # processes. (When the process exits, the memory is reclaimed; it is
  # only leaked *within* the process.)
  #
  # Temporarily disabled on Windows because the `GC_throw_bad_alloc`
  # symbol is missing during linking.
  enableGC ? !stdenv.hostPlatform.isWindows,
}:

mkMesonLibrary (finalAttrs: {
  pname = "nix-expr";
  inherit version;

  workDir = ./.;

  nativeBuildInputs = [
    bison
    flex
    cmake
  ];

  buildInputs = [
    toml11
  ];

  propagatedBuildInputs = [
    nix-util
    nix-store
    nix-fetchers
  ] ++ finalAttrs.passthru.externalPropagatedBuildInputs;

  # Hack for sake of the dev shell
  passthru.externalPropagatedBuildInputs = [
    boost
    nlohmann_json
  ] ++ lib.optional enableGC boehmgc;

  mesonFlags = [
    (lib.mesonEnable "gc" enableGC)
  ];

  env = {
    # Needed for Meson to find Boost.
    # https://github.com/NixOS/nixpkgs/issues/86131.
    BOOST_INCLUDEDIR = "${lib.getDev boost}/include";
    BOOST_LIBRARYDIR = "${lib.getLib boost}/lib";
  };

  meta = {
    platforms = lib.platforms.unix ++ lib.platforms.windows;
  };

})