nixpkgs/pkgs/tools/text/shfmt/default.nix

38 lines
1.0 KiB
Nix
Raw Normal View History

2020-10-30 23:22:22 +00:00
{ lib, buildGoModule, fetchFromGitHub, installShellFiles, scdoc }:
2016-06-15 15:39:43 +01:00
2020-01-12 07:33:16 +00:00
buildGoModule rec {
pname = "shfmt";
version = "3.2.1";
2016-06-15 15:39:43 +01:00
src = fetchFromGitHub {
owner = "mvdan";
repo = "sh";
rev = "v${version}";
sha256 = "1kp4ib0a64cc9qylny48ff5q9ciklzx93yhv7fgqhl1v2c7fm1jp";
2016-06-15 15:39:43 +01:00
};
2020-10-30 22:18:53 +00:00
vendorSha256 = "1ma7nvyn6ylbi8bd7x900i94pzs877kfy9xh0nf1bbify1vcpd29";
subPackages = [ "cmd/shfmt" ];
2020-01-12 07:33:16 +00:00
2020-04-08 01:59:35 +01:00
buildFlagsArray = [ "-ldflags=-s -w -X main.version=${version}" ];
2020-10-30 23:22:22 +00:00
nativeBuildInputs = [ installShellFiles scdoc ];
postBuild = ''
scdoc < cmd/shfmt/shfmt.1.scd > shfmt.1
installManPage shfmt.1
'';
meta = with lib; {
homepage = "https://github.com/mvdan/sh";
2016-06-15 15:39:43 +01:00
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.
'';
2018-08-04 17:38:46 +01:00
license = licenses.bsd3;
2020-06-08 04:24:37 +01:00
maintainers = with maintainers; [ zowoq ];
2016-06-15 15:39:43 +01:00
};
2020-06-08 04:24:37 +01:00
}