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