depot/third_party/nixpkgs/pkgs/tools/text/shfmt/default.nix
Default email ae91cbe6cc Project import generated by Copybara.
GitOrigin-RevId: 536fe36e23ab0fc8b7f35c24603422eee9fc17a2
2021-02-05 18:12:51 +01:00

37 lines
1 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub, installShellFiles, scdoc }:
buildGoModule rec {
pname = "shfmt";
version = "3.2.2";
src = fetchFromGitHub {
owner = "mvdan";
repo = "sh";
rev = "v${version}";
sha256 = "sha256-ZeyHidw8iHboo/LHTR9E3Sqj8euaRvDaYbPQMdecsrk=";
};
vendorSha256 = "1ma7nvyn6ylbi8bd7x900i94pzs877kfy9xh0nf1bbify1vcpd29";
subPackages = [ "cmd/shfmt" ];
buildFlagsArray = [ "-ldflags=-s -w -X main.version=${version}" ];
nativeBuildInputs = [ installShellFiles scdoc ];
postBuild = ''
scdoc < cmd/shfmt/shfmt.1.scd > shfmt.1
installManPage shfmt.1
'';
meta = with lib; {
homepage = "https://github.com/mvdan/sh";
description = "A shell parser and formatter";
longDescription = ''
shfmt formats shell programs. It can use tabs or any number of spaces to indent.
You can feed it standard input, any number of files or any number of directories to recurse into.
'';
license = licenses.bsd3;
maintainers = with maintainers; [ zowoq ];
};
}