1{ lib, stdenv, fetchFromGitHub, asciidoctor, gawk, gnused, runtimeShell }:
2
3stdenv.mkDerivation rec {
4 pname = "esh";
5 version = "0.1.1";
6
7 src = fetchFromGitHub {
8 owner = "jirutka";
9 repo = "esh";
10 rev = "v${version}";
11 sha256 = "1ddaji5nplf1dyvgkrhqjy8m5djaycqcfhjv30yprj1avjymlj6w";
12 };
13
14 nativeBuildInputs = [ asciidoctor ];
15
16 buildInputs = [ gawk gnused ];
17
18 makeFlags = [ "prefix=$(out)" "DESTDIR=" ];
19
20 postPatch = ''
21 patchShebangs .
22 substituteInPlace esh \
23 --replace '"/bin/sh"' '"${runtimeShell}"' \
24 --replace '"awk"' '"${gawk}/bin/awk"' \
25 --replace 'sed' '${gnused}/bin/sed'
26 substituteInPlace tests/test-dump.exp \
27 --replace '#!/bin/sh' '#!${runtimeShell}'
28 '';
29
30 doCheck = true;
31 checkTarget = "test";
32
33 meta = with lib; {
34 description = "Simple templating engine based on shell";
35 homepage = "https://github.com/jirutka/esh";
36 license = licenses.mit;
37 maintainers = with maintainers; [ mnacamura ];
38 platforms = platforms.unix;
39 };
40}