2023-05-24 13:37:59 +00:00
|
|
|
{ lib
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
2024-01-02 11:29:13 +00:00
|
|
|
, stdenv
|
2023-07-15 17:15:38 +00:00
|
|
|
, nix-update-script
|
2023-05-24 13:37:59 +00:00
|
|
|
}:
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "topiary";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "0.3.0";
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tweag";
|
|
|
|
repo = pname;
|
2023-03-15 16:39:30 +00:00
|
|
|
rev = "v${version}";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-zt4uXkO6Y0Yc1Wt8l5O79oKbgNLrgip40ftD7UfUPwo=";
|
2022-12-17 10:02:37 +00:00
|
|
|
};
|
|
|
|
|
2023-03-27 19:17:25 +00:00
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
2023-10-09 19:29:22 +00:00
|
|
|
"tree-sitter-bash-0.19.0" = "sha256-a0/KyHV2jUpytsZSHI7tVw8GfYnuqVjfs5KScLZkB0I=";
|
2023-05-24 13:37:59 +00:00
|
|
|
"tree-sitter-facade-0.9.3" = "sha256-M/npshnHJkU70pP3I4WMXp3onlCSWM5mMIqXP45zcUs=";
|
2023-10-09 19:29:22 +00:00
|
|
|
"tree-sitter-json-0.20.0" = "sha256-cyrea0Y13OVGkXbYE0Cwc7nUsDGEZyoQmPAS9wVuHw0=";
|
2023-07-15 17:15:38 +00:00
|
|
|
"tree-sitter-nickel-0.0.1" = "sha256-aYsEx1Y5oDEqSPCUbf1G3J5Y45ULT9OkD+fn6stzrOU=";
|
2023-10-09 19:29:22 +00:00
|
|
|
"tree-sitter-ocaml-0.20.4" = "sha256-j3Hv2qOMxeBNOW+WIgIYzG3zMIFWPQpoHe94b2rT+A8=";
|
|
|
|
"tree-sitter-ocamllex-0.20.2" = "sha256-YhmEE7I7UF83qMuldHqc/fD/no/7YuZd6CaAIaZ1now=";
|
|
|
|
"tree-sitter-query-0.1.0" = "sha256-5N7FT0HTK3xzzhAlk3wBOB9xlEpKSNIfakgFnsxEi18=";
|
|
|
|
"tree-sitter-rust-0.20.4" = "sha256-seWoMuA87ZWCq3mUXopVeDCcTxX/Bh+B4PFLVa0CBQA=";
|
|
|
|
"tree-sitter-toml-0.5.1" = "sha256-5nLNBxFeOGE+gzbwpcrTVnuL1jLUA0ZLBVw2QrOLsDQ=";
|
2023-05-24 13:37:59 +00:00
|
|
|
"web-tree-sitter-sys-1.3.0" = "sha256-9rKB0rt0y9TD/HLRoB9LjEP9nO4kSWR9ylbbOXo2+2M=";
|
2023-03-27 19:17:25 +00:00
|
|
|
};
|
|
|
|
};
|
2022-12-17 10:02:37 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
cargoBuildFlags = [ "-p" "topiary-cli" ];
|
|
|
|
cargoTestFlags = cargoBuildFlags;
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
env.TOPIARY_LANGUAGE_DIR = "${placeholder "out"}/share/queries";
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
postInstall = ''
|
2023-10-09 19:29:22 +00:00
|
|
|
install -Dm444 queries/* -t $out/share/queries
|
2022-12-17 10:02:37 +00:00
|
|
|
'';
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "A uniform formatter for simple languages, as part of the Tree-sitter ecosystem";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "topiary";
|
2022-12-17 10:02:37 +00:00
|
|
|
homepage = "https://github.com/tweag/topiary";
|
2023-05-24 13:37:59 +00:00
|
|
|
changelog = "https://github.com/tweag/topiary/blob/${src.rev}/CHANGELOG.md";
|
2022-12-17 10:02:37 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ figsoda ];
|
|
|
|
};
|
|
|
|
}
|