Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, rustPlatform
3, fetchFromGitHub
4}:
5
6rustPlatform.buildRustPackage rec {
7 pname = "topiary";
8 version = "0.2.1";
9
10 src = fetchFromGitHub {
11 owner = "tweag";
12 repo = pname;
13 rev = "v${version}";
14 hash = "sha256-ShtwnxkDo/+31jZSg8XWnLLtrkLlqQQ5UiLVrPCM9ag=";
15 };
16
17 cargoLock = {
18 lockFile = ./Cargo.lock;
19 outputHashes = {
20 "tree-sitter-bash-0.19.0" = "sha256-Po2r+wUWJwC+ODk/xotYI7PsmjC3TFSu1dU0FrrnAXQ=";
21 "tree-sitter-facade-0.9.3" = "sha256-M/npshnHJkU70pP3I4WMXp3onlCSWM5mMIqXP45zcUs=";
22 "tree-sitter-nickel-0.0.1" = "sha256-NLgbTl1Te/lHTGra4DdxLtqIg6yXf5lfyl37qpp8SNQ=";
23 "tree-sitter-ocaml-0.20.1" = "sha256-5X2c2Deb8xNlp0LPQKFWIT3jwxKuuKdFlp9b3iA818Y=";
24 "tree-sitter-query-0.1.0" = "sha256-Gv882sbL2fmR++h4/I7dFCp+g6pddRCaLyX7+loEoHU=";
25 "web-tree-sitter-sys-1.3.0" = "sha256-9rKB0rt0y9TD/HLRoB9LjEP9nO4kSWR9ylbbOXo2+2M=";
26 };
27 };
28
29 cargoBuildFlags = [ "-p" "topiary-cli" ];
30 cargoTestFlags = cargoBuildFlags;
31
32 env = {
33 TOPIARY_LANGUAGE_DIR = "${placeholder "out"}/share/languages";
34 };
35
36 # Cargo.lock is outdated
37 postPatch = ''
38 ln -sf ${./Cargo.lock} Cargo.lock
39 '';
40
41 postInstall = ''
42 install -Dm444 languages/* -t $out/share/languages
43 '';
44
45 meta = with lib; {
46 description = "A uniform formatter for simple languages, as part of the Tree-sitter ecosystem";
47 homepage = "https://github.com/tweag/topiary";
48 changelog = "https://github.com/tweag/topiary/blob/${src.rev}/CHANGELOG.md";
49 license = licenses.mit;
50 maintainers = with maintainers; [ figsoda ];
51 };
52}