summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/builders.nix
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-08-07 09:54:10 +0200
committertv <tv@krebsco.de>2016-08-07 09:54:10 +0200
commit3288d6848f774e00a5fbc2ba060f2df695af8e55 (patch)
tree971a8ae4fd7b64d2c5b9374d6707d7dc2bb79beb /krebs/5pkgs/builders.nix
parent3a760096f6b3b49d4bf32465c860ccfd23d174fa (diff)
parentcbf66556afed7220bc95d1716f06cede5a7a8b09 (diff)
Merge remote-tracking branch 'prism/master'
Diffstat (limited to 'krebs/5pkgs/builders.nix')
-rw-r--r--krebs/5pkgs/builders.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/krebs/5pkgs/builders.nix b/krebs/5pkgs/builders.nix
index 4c087bc44..841543819 100644
--- a/krebs/5pkgs/builders.nix
+++ b/krebs/5pkgs/builders.nix
@@ -253,5 +253,27 @@ rec {
${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out
'');
+ writePython2 = name: src: pkgs.runCommand name {} /* sh */ ''
+ name=${assert types.filename.check name; name}
+ src=${shell.escape src}
+
+ # syntax check
+ printf '%s' "$src" > src.py
+ ${pkgs.python2}/bin/python -m py_compile src.py
+
+ cp src.py "$out"
+ '';
+
+ writePython3 = name: src: pkgs.runCommand name {} /* sh */ ''
+ name=${assert types.filename.check name; name}
+ src=${shell.escape src}
+
+ # syntax check
+ printf '%s' "$src" > src.py
+ ${pkgs.python3}/bin/python -m py_compile src.py
+
+ cp src.py "$out"
+ '';
+
writeSed = makeScriptWriter "${pkgs.gnused}/bin/sed -f";
}