summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/builders.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2016-06-12 17:49:59 +0200
committermakefu <github@syntax-fehler.de>2016-06-12 17:49:59 +0200
commited1d336fc85935b73d9f8a2486ea3e95503ab655 (patch)
treec5b57637a8a6c283ee5bb2608d6412edac9bd1c6 /krebs/5pkgs/builders.nix
parent19d5be268368f073401d07f6657cf61827c9d59c (diff)
parentfb8be5838adfe58fc5d13235ac82022cbdb8f6e4 (diff)
Merge remote-tracking branch 'cd/master'
Diffstat (limited to 'krebs/5pkgs/builders.nix')
-rw-r--r--krebs/5pkgs/builders.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/krebs/5pkgs/builders.nix b/krebs/5pkgs/builders.nix
index f60bbc9d0..8ba0ab5a7 100644
--- a/krebs/5pkgs/builders.nix
+++ b/krebs/5pkgs/builders.nix
@@ -81,6 +81,26 @@ rec {
mv "$textPath" $out
'';
+ writeFiles = name: specs0:
+ let
+ specs = mapAttrsToList (path: spec0: {
+ path = assert types.pathname.check path; path;
+ var = "file_${hashString "sha1" path}";
+ text = spec0.text;
+ }) specs0;
+
+ filevars = genAttrs' specs (spec: nameValuePair spec.var spec.text);
+
+ env = filevars // { passAsFile = attrNames filevars; };
+ in
+ pkgs.runCommand name env /* sh */ ''
+ set -efu
+ PATH=${makeBinPath [pkgs.coreutils]}
+ ${concatMapStrings (spec: /* sh */ ''
+ install -D ''$${spec.var}Path $out${spec.path}
+ '') specs}
+ '';
+
writeHaskell =
k:
let