Skip to content

Commit

Permalink
fix(rust-analyzer): update shims required for --version
Browse files Browse the repository at this point in the history
  • Loading branch information
ThinkChaos committed Apr 7, 2024
1 parent 99c6241 commit 9efeae1
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,22 @@ let
sha256 = narHash;
};
};

formatDate = date:
let
year = substring 0 4 date;
month = substring 4 2 date;
day = substring 6 2 date;
in
"${year}-${month}-${day}";
in

{ system ? currentSystem
, pkgs ? import (getFlake "nixpkgs") { localSystem = { inherit system; }; }
, lib ? pkgs.lib
, rust-analyzer-src ? getFlake "rust-analyzer-src"
, rust-analyzer-rev ? substring 0 7 (rust-analyzer-src.rev or "0000000")
, rust-analyzer-rev ? rust-analyzer-src.rev or "0000000000000000000000000000000000000000"
, rust-analyzer-date ? formatDate (rust-analyzer-src.lastModifiedDate or "00000000000000")
}:

let
Expand Down Expand Up @@ -172,7 +181,17 @@ nightlyToolchains.${v} // rec {
];
doCheck = false;
CARGO_INCREMENTAL = 0;
RUST_ANALYZER_REV = rust-analyzer-rev;

# See rust-analyzer's crates/rust-analyzer/build.rs
patchPhase = ''
mkdir .git/
echo nightly > .git/HEAD
'';
CFG_RELEASE_CHANNEL = "nightly";
RA_COMMIT_HASH = rust-analyzer-rev;
RA_COMMIT_SHORT_HASH = substring 0 7 rust-analyzer-rev;
RA_COMMIT_DATE = rust-analyzer-date;

meta = {
maintainers = with maintainers; [ figsoda ];
mainProgram = "rust-analyzer";
Expand Down

0 comments on commit 9efeae1

Please sign in to comment.