{ fetchFromGitHub , lib , rustPlatform , stdenvNoCC , lua52Support ? true , luauSupport ? false }: rustPlatform.buildRustPackage rec { pname = "stylua"; version = "0.9.3"; src = fetchFromGitHub { owner = "johnnymorganz"; repo = pname; rev = "v${version}"; sha256 = "1xpl3nxiln6hxxjd9nx99h4qijjym3afxm5nalw40p152h8zgig4"; }; cargoSha256 = "012zv1myackwk0x73l6ri7zzrzwdkd970hh4p30b590bmsam6sb9"; cargoBuildFlags = lib.optionals lua52Support [ "--features" "lua52" ] ++ lib.optionals luauSupport [ "--features" "luau" ]; # test_standard fails on darwin doCheck = !stdenvNoCC.isDarwin; meta = with lib; { description = "An opinionated Lua code formatter"; homepage = "https://github.com/johnnymorganz/stylua"; changelog = "https://github.com/johnnymorganz/stylua/blob/v${version}/CHANGELOG.md"; license = licenses.mpl20; maintainers = with maintainers; [ figsoda ]; }; }