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