Skip to content

Commit 5232213

Browse files
authored
flake: update nixpkgs input, nixVersions.nix_2_28 -> nixVersions.nix_2_30 (#709)
Nix 2.30 has significanltly improved memory usage and eval performance, which would be nice to have in nixd. Unpinning boost182 is necessary because: 1. Now nix from nixpkgs propagates its boost build input. 2. Linking 2 different versions of boost into the same executable is rather risky wrt to ABI breaks.
1 parent 89332c3 commit 5232213

File tree

9 files changed

+40
-29
lines changed

9 files changed

+40
-29
lines changed

default.nix

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
lib,
33
stdenv,
4-
boost182,
4+
boost,
55
gtest,
66
lit,
77
llvmPackages,
88
meson,
99
ninja,
10-
nix,
10+
nixComponents,
1111
pkg-config,
1212
nlohmann_json,
1313
python312,
@@ -31,9 +31,12 @@ stdenv.mkDerivation {
3131
nativeCheckInputs = [ lit ];
3232

3333
buildInputs = [
34-
nix
34+
nixComponents.nix-main
35+
nixComponents.nix-expr
36+
nixComponents.nix-cmd
37+
nixComponents.nix-flake
3538
gtest
36-
boost182
39+
boost
3740
llvmPackages.llvm
3841
nlohmann_json
3942
];

flake.lock

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
inputs = {
3-
# Temporary, until channel catchs up with Nix 2.28
4-
nixpkgs.url = "github:NixOS/nixpkgs";
3+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
54

65
flake-parts.url = "github:hercules-ci/flake-parts";
76

@@ -34,15 +33,15 @@
3433
callPackage
3534
stdenv
3635
;
37-
nix = nixVersions.nix_2_28;
36+
nixComponents = nixVersions.nixComponents_2_30;
3837
llvmPackages = llvmPackages_19;
3938
nixf = callPackage ./libnixf { };
40-
nixt = callPackage ./libnixt { inherit nix; };
39+
nixt = callPackage ./libnixt { inherit nixComponents; };
4140
nixd = callPackage ./nixd {
42-
inherit nix nixf nixt;
41+
inherit nixComponents nixf nixt;
4342
inherit llvmPackages;
4443
};
45-
nixdMono = callPackage ./. { inherit nix llvmPackages; };
44+
nixdMono = callPackage ./. { inherit nixComponents llvmPackages; };
4645
nixdLLVM = nixdMono.override { stdenv = if stdenv.isDarwin then stdenv else llvmPackages.stdenv; };
4746
regressionDeps = with pkgs; [
4847
clang-tools
@@ -53,7 +52,7 @@
5352
nativeBuildInputs = old.nativeBuildInputs ++ regressionDeps;
5453
shellHook = ''
5554
export PATH="${pkgs.clang-tools}/bin:$PATH"
56-
export NIX_SRC=${nix.src}
55+
export NIX_SRC=${nixComponents.src}
5756
export NIX_PATH=nixpkgs=${nixpkgs}
5857
'';
5958
hardeningDisable = [ "fortify" ];

libnixf/default.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
pkg-config,
77
lit,
88
gtest,
9-
boost182,
9+
boost,
1010
nlohmann_json,
1111
python312,
1212
}:
@@ -40,7 +40,7 @@ stdenv.mkDerivation {
4040

4141
buildInputs = [
4242
gtest
43-
boost182
43+
boost
4444
nlohmann_json
4545
];
4646

libnixt/default.nix

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
meson,
55
ninja,
66
pkg-config,
7-
nix,
87
gtest,
9-
boost182,
8+
boost,
9+
nixComponents,
1010
}:
1111

1212
stdenv.mkDerivation {
@@ -33,9 +33,12 @@ stdenv.mkDerivation {
3333
];
3434

3535
buildInputs = [
36-
nix
36+
nixComponents.nix-main
37+
nixComponents.nix-expr
38+
nixComponents.nix-cmd
39+
nixComponents.nix-flake
3740
gtest
38-
boost182
41+
boost
3942
];
4043

4144
meta = {

libnixt/test/StateTest.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <nix/cmd/common-eval-args.hh>
44
#include <nix/expr/eval.hh>
5-
#include <nix/store/store-api.hh>
5+
#include <nix/store/store-open.hh>
66

77
namespace nixt {
88

nixd/default.nix

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
meson,
55
ninja,
66
pkg-config,
7-
nix,
7+
nixComponents,
88
nixf,
99
nixt,
1010
llvmPackages,
1111
gtest,
12-
boost182,
12+
boost,
1313
}:
1414

1515
let
@@ -39,12 +39,14 @@ stdenv.mkDerivation {
3939
];
4040

4141
buildInputs = [
42-
nix
42+
nixComponents.nix-expr
43+
nixComponents.nix-main
44+
nixComponents.nix-cmd
4345
nixf
4446
nixt
4547
llvmPackages.llvm
4648
gtest
47-
boost182
49+
boost
4850
];
4951

5052
meta = {

nixd/include/nixd/Controller/Controller.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ class Controller : public lspserver::LSPServer {
133133
return TU ? getAST(*TU) : nullptr;
134134
}
135135

136-
boost::asio::thread_pool Pool;
136+
// Default constructor is broken in Boost 1.87:
137+
// https://github.com/boostorg/asio/commit/30b5974ed34bfa321d268b3135ffaffcb261461a
138+
boost::asio::thread_pool Pool{
139+
static_cast<size_t>(boost::asio::detail::default_thread_pool_size())};
137140

138141
/// Action right after a document is added (including updates).
139142
void actOnDocumentAdd(lspserver::PathRef File,

nixd/lib/Eval/AttrSetProvider.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <nix/cmd/common-eval-args.hh>
77
#include <nix/expr/attr-path.hh>
88
#include <nix/expr/nixexpr.hh>
9-
#include <nix/store/store-api.hh>
9+
#include <nix/store/store-open.hh>
1010
#include <nixt/Value.h>
1111

1212
using namespace nixd;
@@ -101,7 +101,7 @@ void fillOptionDeclarationPositions(nix::EvalState &State, nix::Value &V,
101101
State.forceValue(V, nix::noPos);
102102
if (V.type() != nix::ValueType::nList)
103103
return;
104-
for (nix::Value *Item : V.listItems()) {
104+
for (nix::Value *Item : V.listView()) {
105105
// Each item should have "column", "line", "file" fields.
106106
lspserver::Location Loc;
107107
fillUnsafeGetAttrPosLocation(State, *Item, Loc);
@@ -195,7 +195,7 @@ std::optional<ValueDescription> describeValue(nix::EvalState &State,
195195
.Args = PrimOp->args,
196196
};
197197
} else if (V.isLambda()) {
198-
auto *Lambda = V.payload.lambda.fun;
198+
auto *Lambda = V.lambda().fun;
199199
assert(Lambda);
200200
const auto DocComment = Lambda->docComment;
201201

0 commit comments

Comments
 (0)