nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6 scdoc,
7}:
8
9buildGoModule rec {
10 pname = "shfmt";
11 version = "3.12.0";
12
13 src = fetchFromGitHub {
14 owner = "mvdan";
15 repo = "sh";
16 rev = "v${version}";
17 hash = "sha256-3a0N5GsqZvJVx1qhsTzwtC2SBtexdXJMalerM+joNIc=";
18 };
19
20 vendorHash = "sha256-jvsX0nn9cHq2cZUrD9E1eMtOiy5I4wfpngAc+6qUbEE=";
21
22 subPackages = [ "cmd/shfmt" ];
23
24 ldflags = [
25 "-s"
26 "-w"
27 "-X main.version=${version}"
28 ];
29
30 nativeBuildInputs = [
31 installShellFiles
32 scdoc
33 ];
34
35 postBuild = ''
36 scdoc < cmd/shfmt/shfmt.1.scd > shfmt.1
37 installManPage shfmt.1
38 '';
39
40 meta = with lib; {
41 homepage = "https://github.com/mvdan/sh";
42 description = "Shell parser and formatter";
43 longDescription = ''
44 shfmt formats shell programs. It can use tabs or any number of spaces to indent.
45 You can feed it standard input, any number of files or any number of directories to recurse into.
46 '';
47 license = licenses.bsd3;
48 maintainers = with maintainers; [
49 zowoq
50 SuperSandro2000
51 ];
52 mainProgram = "shfmt";
53 };
54}