1 { bash, stdenv, lib, runCommand, writeText, fetchFromGitHub }:
5 shab = stdenv.mkDerivation {
9 src = fetchFromGitHub {
13 hash = "sha256-UW4tRZSir7KG7KXg0sOCd8kkIydEwZ6kdwxCeo0Ojgo=";
17 for f in test.sh test/*.sh; do
23 doInstallCheck = true;
31 cp ./shab $out/bin/shab
34 installCheckPhase = ''
35 [[ "$(echo 'Hello $entity' | entity=world $out/bin/shab)" == 'Hello world' ]]
39 inherit render renderText;
43 description = "Bash templating language";
45 homepage = "https://github.com/zimbatm/shab";
46 license = licenses.unlicense;
47 maintainers = with maintainers; [ zimbatm ];
48 platforms = bash.meta.platforms;
53 shabScript: a path or filename to use as a template
54 parameters.name: the name to use as part of the store path
55 parameters: variables to expose to the template
57 render = shabScript: parameters:
61 in runCommand "out" (parameters // extraParams) ''
62 ${shab}/bin/shab "$shabScript" >$out
66 shabScriptText: a string to use as a template
67 parameters.name: the name to use as part of the store path
68 parameters: variables to expose to the template
70 renderText = shabScriptText: parameters:
71 render (writeText "template" shabScriptText) parameters;