nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 shfmt,
4 stdenvNoCC,
5}:
6# See https://nixos.org/manual/nixpkgs/unstable/#tester-shfmt
7# or doc/build-helpers/testers.chapter.md
8{
9 name,
10 src,
11 indent ? 2,
12}:
13stdenvNoCC.mkDerivation (finalAttrs: {
14 __structuredAttrs = true;
15 strictDeps = true;
16 inherit src indent;
17 name = "shfmt-${name}";
18 dontUnpack = true; # Unpack phase tries to extract archive
19 nativeBuildInputs = [ shfmt ];
20 doCheck = true;
21 dontConfigure = true;
22 dontBuild = true;
23 checkPhase = ''
24 shfmt --diff --indent $indent --simplify "$src"
25 '';
26 installPhase = ''
27 touch "$out"
28 '';
29})