1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 boost,
7 gtest,
8 llvmPackages,
9 meson,
10 ninja,
11 nixVersions,
12 nix-update-script,
13 nixd,
14 nixf,
15 nixt,
16 nlohmann_json,
17 pkg-config,
18 testers,
19 python3,
20}:
21
22let
23 nixComponents = nixVersions.nixComponents_2_30;
24 common = rec {
25 version = "2.7.0";
26
27 src = fetchFromGitHub {
28 owner = "nix-community";
29 repo = "nixd";
30 tag = version;
31 hash = "sha256-VPUX/68ysFUr1S8JW9I1rU5UcRoyZiCjL+9u2owrs6w=";
32 };
33
34 nativeBuildInputs = [
35 meson
36 ninja
37 python3
38 pkg-config
39 ];
40
41 mesonBuildType = "release";
42
43 strictDeps = true;
44
45 doCheck = true;
46
47 meta = {
48 homepage = "https://github.com/nix-community/nixd";
49 changelog = "https://github.com/nix-community/nixd/releases/tag/${version}";
50 license = lib.licenses.lgpl3Plus;
51 maintainers = with lib.maintainers; [
52 inclyc
53 Ruixi-rebirth
54 aleksana
55 redyf
56 ];
57 platforms = lib.platforms.unix;
58 };
59 };
60in
61{
62 nixf = stdenv.mkDerivation (
63 common
64 // {
65 pname = "nixf";
66
67 sourceRoot = "${common.src.name}/libnixf";
68
69 outputs = [
70 "out"
71 "dev"
72 ];
73
74 buildInputs = [
75 gtest
76 boost
77 nlohmann_json
78 ];
79
80 passthru.tests.pkg-config = testers.hasPkgConfigModules {
81 package = nixf;
82 moduleNames = [ "nixf" ];
83 };
84
85 meta = common.meta // {
86 description = "Nix language frontend, parser & semantic analysis";
87 mainProgram = "nixf-tidy";
88 };
89 }
90 );
91
92 nixt = stdenv.mkDerivation (
93 common
94 // {
95 pname = "nixt";
96
97 sourceRoot = "${common.src.name}/libnixt";
98
99 outputs = [
100 "out"
101 "dev"
102 ];
103
104 buildInputs = [
105 nixComponents.nix-main
106 nixComponents.nix-expr
107 nixComponents.nix-cmd
108 nixComponents.nix-flake
109 gtest
110 boost
111 ];
112
113 passthru.tests.pkg-config = testers.hasPkgConfigModules {
114 package = nixt;
115 moduleNames = [ "nixt" ];
116 };
117
118 meta = common.meta // {
119 description = "Supporting library that wraps C++ nix";
120 };
121 }
122 );
123
124 nixd = stdenv.mkDerivation (
125 common
126 // {
127 pname = "nixd";
128
129 sourceRoot = "${common.src.name}/nixd";
130
131 buildInputs = [
132 nixComponents.nix-main
133 nixComponents.nix-expr
134 nixComponents.nix-cmd
135 nixComponents.nix-flake
136 nixf
137 nixt
138 llvmPackages.llvm
139 gtest
140 boost
141 ];
142
143 nativeBuildInputs = common.nativeBuildInputs ++ [ cmake ];
144
145 # See https://github.com/nix-community/nixd/issues/519
146 doCheck = false;
147
148 passthru = {
149 updateScript = nix-update-script { };
150 tests.version = testers.testVersion { package = nixd; };
151 };
152
153 meta = common.meta // {
154 description = "Feature-rich Nix language server interoperating with C++ nix";
155 mainProgram = "nixd";
156 };
157 }
158 );
159}