summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-11-25 00:17:57 +0100
committertv <tv@krebsco.de>2016-11-25 00:17:57 +0100
commitb3c6e9a2bde5d1c911d1bb17ca3218acab7285b8 (patch)
tree4b060a676c42997c8e640ff93c3da4d4d6aa08b1
parentd59facd88c7d33d0ac125eb93392d2a67b46aea4 (diff)
writeBash*: use shellcheck (for warnings only)
-rw-r--r--krebs/5pkgs/builders.nix12
1 files changed, 11 insertions, 1 deletions
diff --git a/krebs/5pkgs/builders.nix b/krebs/5pkgs/builders.nix
index 77055d16a..49d04be4d 100644
--- a/krebs/5pkgs/builders.nix
+++ b/krebs/5pkgs/builders.nix
@@ -37,7 +37,17 @@ rec {
};
};
- writeBash = makeScriptWriter "${pkgs.bash}/bin/bash";
+ writeBash = name: text:
+ assert (with types; either absolute-pathname filename).check name;
+ pkgs.writeOut (baseNameOf name) {
+ ${optionalString (types.absolute-pathname.check name) name} = {
+ check = pkgs.writeDash "shellcheck.sh" ''
+ ${pkgs.haskellPackages.ShellCheck}/bin/shellcheck "$1" || :
+ '';
+ executable = true;
+ text = "#! ${pkgs.bash}/bin/bash\n${text}";
+ };
+ };
writeBashBin = name:
assert types.filename.check name;