1{
2 lib,
3 stdenv,
4 mkMesonLibrary,
5
6 nix-util,
7 nix-store,
8 nix-fetchers,
9 nix-expr,
10 nix-flake,
11 nix-main,
12 editline,
13 readline,
14 lowdown,
15 nlohmann_json,
16
17 # Configuration Options
18
19 version,
20
21 # Whether to enable Markdown rendering in the Nix binary.
22 enableMarkdown ? !stdenv.hostPlatform.isWindows,
23
24 # Which interactive line editor library to use for Nix's repl.
25 #
26 # Currently supported choices are:
27 #
28 # - editline (default)
29 # - readline
30 readlineFlavor ? if stdenv.hostPlatform.isWindows then "readline" else "editline",
31}:
32
33mkMesonLibrary (finalAttrs: {
34 pname = "nix-cmd";
35 inherit version;
36
37 workDir = ./.;
38
39 buildInputs = [
40 ({ inherit editline readline; }.${readlineFlavor})
41 ]
42 ++ lib.optional enableMarkdown lowdown;
43
44 propagatedBuildInputs = [
45 nix-util
46 nix-store
47 nix-fetchers
48 nix-expr
49 nix-flake
50 nix-main
51 nlohmann_json
52 ];
53
54 mesonFlags = [
55 (lib.mesonEnable "markdown" enableMarkdown)
56 (lib.mesonOption "readline-flavor" readlineFlavor)
57 ];
58
59 meta = {
60 platforms = lib.platforms.unix ++ lib.platforms.windows;
61 };
62
63})