writeOut: add support for text checking

This commit is contained in:
tv 2016-11-25 00:15:13 +01:00
parent 51fcdfac0a
commit d59facd88c

View File

@ -91,6 +91,7 @@ rec {
writers.text = writers.text =
{ path { path
, check ? null
, executable ? false , executable ? false
, mode ? if executable then "0755" else "0644" , mode ? if executable then "0755" else "0644"
, text , text
@ -102,6 +103,9 @@ rec {
var = "file_${hashString "sha1" path}"; var = "file_${hashString "sha1" path}";
val = text; val = text;
install = /* sh */ '' install = /* sh */ ''
${optionalString (check != null) /* sh */ ''
${check} ''$${var}Path
''}
${pkgs.coreutils}/bin/install -m ${mode} -D ''$${var}Path $out${path} ${pkgs.coreutils}/bin/install -m ${mode} -D ''$${var}Path $out${path}
''; '';
}; };