summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2018-01-02 12:59:01 +0100
committerlassulus <lassulus@lassul.us>2018-01-02 12:59:01 +0100
commitc25054b4a0c034b9c410799bf29486820d9778d7 (patch)
tree7cc454683935333fe15717382a14ce433eada761 /krebs
parentbfde8bea27144c441f023fca6ac888c3baec0aeb (diff)
writers: add deps & flake8 to writePython{2,3}
Diffstat (limited to 'krebs')
-rw-r--r--krebs/5pkgs/writers.nix40
1 files changed, 20 insertions, 20 deletions
diff --git a/krebs/5pkgs/writers.nix b/krebs/5pkgs/writers.nix
index 6e67ed699..0cc4efb51 100644
--- a/krebs/5pkgs/writers.nix
+++ b/krebs/5pkgs/writers.nix
@@ -283,27 +283,27 @@ with import <stockholm/lib>;
${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out
'');
- writePython2 = 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 "python2check.sh" ''
- exec ${pkgs.python2}/bin/python -m py_compile "$1"
- '';
- inherit text;
- };
- };
+ writePython2 = deps:
+ let
+ py = pkgs.python2.withPackages(ps: attrVals deps ps);
+ in
+ pkgs.makeScriptWriter {
+ interpreter = "${py}/bin/python";
+ check = pkgs.writeDash "python2check.sh" ''
+ exec ${pkgs.python2Packages.flake8}/bin/flake8 --show-source "$1"
+ '';
+ };
- writePython3 = 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 "python3check.sh" ''
- exec ${pkgs.python3}/bin/python -m py_compile "$textPath"
- '';
- inherit text;
- };
- };
+ writePython3 = deps:
+ let
+ py = pkgs.python3.withPackages(ps: attrVals deps ps);
+ in
+ pkgs.makeScriptWriter {
+ interpreter = "${py}/bin/python";
+ check = pkgs.writeDash "python3check.sh" ''
+ exec ${pkgs.python3Packages.flake8}/bin/flake8 --show-source "$1"
+ '';
+ };
writeSed = pkgs.makeScriptWriter {
interpreter = "${pkgs.gnused}/bin/sed -f";