diff --git a/pkgs/development/tools/stylua/default.nix b/pkgs/development/tools/stylua/default.nix new file mode 100644 index 000000000000..56c57483ddc5 --- /dev/null +++ b/pkgs/development/tools/stylua/default.nix @@ -0,0 +1,35 @@ +{ fetchFromGitHub +, lib +, rustPlatform +, stdenvNoCC +, lua52Support ? true +, luauSupport ? false +}: + +rustPlatform.buildRustPackage rec { + pname = "stylua"; + version = "0.8.1"; + + src = fetchFromGitHub { + owner = "johnnymorganz"; + repo = pname; + rev = "v${version}"; + sha256 = "0gjm9pvwfbwhd49pm5sw5plwhlhvbfkms44h67zgvy7xzqv8h3dw"; + }; + + cargoSha256 = "117m78naldp6yvwcccvsrbnx6x6287cvq0saa06pmiqv1rqm50m3"; + + 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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4ba603980bd6..9b3952e224c2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14038,6 +14038,8 @@ in strace = callPackage ../development/tools/misc/strace { }; + stylua = callPackage ../development/tools/stylua { }; + summon = callPackage ../development/tools/summon { }; svlint = callPackage ../development/tools/analysis/svlint { };