2023-05-22 14:24:43 +00:00
|
|
|
{ lib
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
2023-06-12 15:29:13 +00:00
|
|
|
, nix-update-script
|
2023-05-22 14:24:43 +00:00
|
|
|
}:
|
2022-12-02 16:41:17 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "topiary";
|
2023-06-12 13:47:44 +00:00
|
|
|
version = "0.2.2";
|
2022-12-02 16:41:17 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tweag";
|
|
|
|
repo = pname;
|
2023-03-10 10:49:45 +00:00
|
|
|
rev = "v${version}";
|
2023-06-12 13:47:44 +00:00
|
|
|
hash = "sha256-dovuVMvD/M5Dp6G7/54W8eWiXkNbX9QZb38x7+AD1FA=";
|
2022-12-02 16:41:17 +00:00
|
|
|
};
|
|
|
|
|
2023-03-25 23:16:46 +00:00
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
2023-05-22 14:24:43 +00:00
|
|
|
"tree-sitter-bash-0.19.0" = "sha256-Po2r+wUWJwC+ODk/xotYI7PsmjC3TFSu1dU0FrrnAXQ=";
|
|
|
|
"tree-sitter-facade-0.9.3" = "sha256-M/npshnHJkU70pP3I4WMXp3onlCSWM5mMIqXP45zcUs=";
|
2023-06-12 13:47:44 +00:00
|
|
|
"tree-sitter-nickel-0.0.1" = "sha256-aYsEx1Y5oDEqSPCUbf1G3J5Y45ULT9OkD+fn6stzrOU=";
|
2023-05-22 14:24:43 +00:00
|
|
|
"tree-sitter-query-0.1.0" = "sha256-Gv882sbL2fmR++h4/I7dFCp+g6pddRCaLyX7+loEoHU=";
|
|
|
|
"web-tree-sitter-sys-1.3.0" = "sha256-9rKB0rt0y9TD/HLRoB9LjEP9nO4kSWR9ylbbOXo2+2M=";
|
2023-03-25 23:16:46 +00:00
|
|
|
};
|
|
|
|
};
|
2022-12-02 16:41:17 +00:00
|
|
|
|
2023-05-22 14:24:43 +00:00
|
|
|
cargoBuildFlags = [ "-p" "topiary-cli" ];
|
|
|
|
cargoTestFlags = cargoBuildFlags;
|
|
|
|
|
|
|
|
env = {
|
|
|
|
TOPIARY_LANGUAGE_DIR = "${placeholder "out"}/share/languages";
|
|
|
|
};
|
|
|
|
|
2023-05-23 11:27:18 +00:00
|
|
|
# Cargo.lock is outdated
|
|
|
|
postPatch = ''
|
|
|
|
ln -sf ${./Cargo.lock} Cargo.lock
|
|
|
|
'';
|
|
|
|
|
2022-12-02 16:41:17 +00:00
|
|
|
postInstall = ''
|
|
|
|
install -Dm444 languages/* -t $out/share/languages
|
|
|
|
'';
|
|
|
|
|
2023-06-12 15:29:13 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
|
2022-12-02 16:41:17 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A uniform formatter for simple languages, as part of the Tree-sitter ecosystem";
|
|
|
|
homepage = "https://github.com/tweag/topiary";
|
2023-05-22 14:24:43 +00:00
|
|
|
changelog = "https://github.com/tweag/topiary/blob/${src.rev}/CHANGELOG.md";
|
2022-12-02 16:41:17 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ figsoda ];
|
|
|
|
};
|
|
|
|
}
|