1{ lib
2, rustPlatform
3, fetchFromGitHub
4 # lua54 implies lua52/lua53
5, features ? [ "lua54" "luau" ]
6}:
7
8rustPlatform.buildRustPackage rec {
9 pname = "stylua";
10 version = "0.19.1";
11
12 src = fetchFromGitHub {
13 owner = "johnnymorganz";
14 repo = pname;
15 rev = "v${version}";
16 sha256 = "sha256-Bw9+BUvZC4sRLFyU5K6FHsWVZ3PTlMAonRmTSwV5AwU=";
17 };
18
19 cargoSha256 = "sha256-bainEM4eRMNyecSBi5k1ifjDULWdXed6GP6i10IVA+w=";
20
21 # remove cargo config so it can find the linker on aarch64-unknown-linux-gnu
22 postPatch = ''
23 rm .cargo/config.toml
24 '';
25
26 buildFeatures = features;
27
28 meta = with lib; {
29 description = "An opinionated Lua code formatter";
30 homepage = "https://github.com/johnnymorganz/stylua";
31 changelog = "https://github.com/johnnymorganz/stylua/blob/v${version}/CHANGELOG.md";
32 license = licenses.mpl20;
33 maintainers = with maintainers; [ figsoda ];
34 mainProgram = "stylua";
35 };
36}