1{ fetchFromGitHub
2, lib
3, rustPlatform
4, stdenvNoCC
5, lua52Support ? true
6, luauSupport ? false
7}:
8
9rustPlatform.buildRustPackage rec {
10 pname = "stylua";
11 version = "0.11.2";
12
13 src = fetchFromGitHub {
14 owner = "johnnymorganz";
15 repo = pname;
16 rev = "v${version}";
17 sha256 = "sha256-rdtFzHpOvv1uJBigJWenWyIZF/wpYP7iBW2FCsfq2d4=";
18 };
19
20 cargoSha256 = "sha256-/4ZW1FIfK51ak2EIV6dYY3XpucPPR+OZySPWwcKP4v0=";
21
22 buildFeatures = lib.optional lua52Support "lua52"
23 ++ lib.optional luauSupport "luau";
24
25 # test_standard fails on darwin
26 doCheck = !stdenvNoCC.isDarwin;
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 };
35}