Skip to content

Commit 8ca56ca

Browse files
committed
fix compilation with nix 2.25
1 parent 6d80199 commit 8ca56ca

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

flake.lock

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
inputs = {
3-
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
3+
# TODO: switch back once nix 2.25 hits nixpkgs-unstable
4+
# https://nixpk.gs/pr-tracker.html?pr=355350
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
6+
#nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
47

58
flake-parts.url = "github:hercules-ci/flake-parts";
69

@@ -33,7 +36,7 @@
3336
callPackage
3437
stdenv
3538
;
36-
nix = nixVersions.nix_2_24;
39+
nix = nixVersions.nix_2_25;
3740
llvmPackages = llvmPackages_16;
3841
nixf = callPackage ./libnixf { };
3942
nixt = callPackage ./libnixt { inherit nix; };

libnixt/test/Value.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ TEST_F(ValueTest, selectAttrPath) {
5858
nix::Value &Kern = selectStringViews(*State, Nested, {"c", "d"});
5959

6060
ASSERT_EQ(Kern.type(), nix::ValueType::nInt);
61-
ASSERT_EQ(Kern.integer(), 1);
61+
ASSERT_EQ(static_cast<long int>(Kern.integer()), 1L);
6262
}
6363

6464
} // namespace

nixd/lib/Eval/AttrSetProvider.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ std::optional<Location> locationOf(nix::PosTable &PTable, nix::Value &V) {
5454
return std::nullopt;
5555

5656
Position LPos = {
57-
.line = static_cast<int>(NixPos.line - 1),
58-
.character = static_cast<int>(NixPos.column - 1),
57+
.line = static_cast<long int>(NixPos.line - 1),
58+
.character = static_cast<long int>(NixPos.column - 1),
5959
};
6060

6161
return Location{
@@ -86,8 +86,8 @@ void fillUnsafeGetAttrPosLocation(nix::EvalState &State, nix::Value &V,
8686
Column.type() == nix::ValueType::nInt) {
8787

8888
// Nix position starts from "1" however lsp starts from zero.
89-
lspserver::Position Pos = {static_cast<int>(Line.integer()) - 1,
90-
static_cast<int>(Column.integer()) - 1};
89+
lspserver::Position Pos = {static_cast<long int>(Line.integer()) - 1,
90+
static_cast<long int>(Column.integer()) - 1};
9191
Loc.range = {Pos, Pos};
9292
}
9393
}

nixd/lspserver/include/lspserver/Protocol.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ bool fromJSON(const llvm::json::Value &, VersionedTextDocumentIdentifier &,
127127

128128
struct Position {
129129
/// Line position in a document (zero-based).
130-
int line = 0;
130+
long int line = 0;
131131

132132
/// Character offset on a line in a document (zero-based).
133133
/// WARNING: this is in UTF-16 codepoints, not bytes or characters!
134134
/// Use the functions in SourceCode.h to construct/interpret Positions.
135-
int character = 0;
135+
long int character = 0;
136136

137137
friend bool operator==(const Position &LHS, const Position &RHS) {
138138
return std::tie(LHS.line, LHS.character) ==

0 commit comments

Comments
 (0)