diff options
author | tv <tv@krebsco.de> | 2016-06-13 01:28:43 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2016-06-13 01:38:58 +0200 |
commit | e769ff083892d6e4daafee657dae4f2223ce7727 (patch) | |
tree | 4c44d3f2528658aae52628bee9d1f22cbecf31d2 /krebs/5pkgs | |
parent | fcfe4b646153e36aa9c8485693a13ae83c83a44d (diff) |
lib.write{Files => Out}: admit file mode
Diffstat (limited to 'krebs/5pkgs')
-rw-r--r-- | krebs/5pkgs/builders.nix | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/krebs/5pkgs/builders.nix b/krebs/5pkgs/builders.nix index 8ba0ab5a7..13f30ac41 100644 --- a/krebs/5pkgs/builders.nix +++ b/krebs/5pkgs/builders.nix @@ -81,12 +81,23 @@ rec { mv "$textPath" $out ''; - writeFiles = name: specs0: + writeOut = name: specs0: let - specs = mapAttrsToList (path: spec0: { - path = assert types.pathname.check path; path; + specs = mapAttrsToList (path0: spec0: rec { + path = guard { + type = types.pathname; + value = path0; + }; var = "file_${hashString "sha1" path}"; text = spec0.text; + executable = guard { + type = types.bool; + value = spec0.executable or false; + }; + mode = guard { + type = types.file-mode; + value = spec0.mode or (if executable then "0755" else "0644"); + }; }) specs0; filevars = genAttrs' specs (spec: nameValuePair spec.var spec.text); @@ -97,7 +108,7 @@ rec { set -efu PATH=${makeBinPath [pkgs.coreutils]} ${concatMapStrings (spec: /* sh */ '' - install -D ''$${spec.var}Path $out${spec.path} + install -m ${spec.mode} -D ''$${spec.var}Path $out${spec.path} '') specs} ''; |