Skip to content

Commit

Permalink
fix compilation with nix 2.25
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 committed Nov 23, 2024
1 parent 6d80199 commit f9630fb
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
# TODO: switch back once nix 2.25 hits nixpkgs-unstable
# https://nixpk.gs/pr-tracker.html?pr=355350
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
#nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";

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

Expand Down Expand Up @@ -33,7 +36,7 @@
callPackage
stdenv
;
nix = nixVersions.nix_2_24;
nix = nixVersions.nix_2_25;
llvmPackages = llvmPackages_16;
nixf = callPackage ./libnixf { };
nixt = callPackage ./libnixt { inherit nix; };
Expand Down
2 changes: 1 addition & 1 deletion libnixt/test/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ TEST_F(ValueTest, selectAttrPath) {
nix::Value &Kern = selectStringViews(*State, Nested, {"c", "d"});

ASSERT_EQ(Kern.type(), nix::ValueType::nInt);
ASSERT_EQ(Kern.integer(), 1);
ASSERT_EQ(Kern.integer(), nix::NixInt{ 1 });
}

} // namespace
8 changes: 4 additions & 4 deletions nixd/lib/Eval/AttrSetProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ std::optional<Location> locationOf(nix::PosTable &PTable, nix::Value &V) {
return std::nullopt;

Position LPos = {
.line = static_cast<int>(NixPos.line - 1),
.character = static_cast<int>(NixPos.column - 1),
.line = static_cast<long int>(NixPos.line - 1),
.character = static_cast<long int>(NixPos.column - 1),
};

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

// Nix position starts from "1" however lsp starts from zero.
lspserver::Position Pos = {static_cast<int>(Line.integer()) - 1,
static_cast<int>(Column.integer()) - 1};
lspserver::Position Pos = {static_cast<long int>(Line.integer()) - 1,
static_cast<long int>(Column.integer()) - 1};
Loc.range = {Pos, Pos};
}
}
Expand Down
4 changes: 2 additions & 2 deletions nixd/lspserver/include/lspserver/Protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ bool fromJSON(const llvm::json::Value &, VersionedTextDocumentIdentifier &,

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

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

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

0 comments on commit f9630fb

Please sign in to comment.