From d815a9ae5538c997c27e415594ce9cab05faa5a8 Mon Sep 17 00:00:00 2001 From: atse Date: Fri, 23 Aug 2024 11:30:16 +0800 Subject: [PATCH] flake: Add pytec runnables to devShell Makes it possible to directly run `autotune`, `plot` and `test` in the devShell. --- flake.nix | 14 ++++++++++++++ pythermostat/autotune.py | 0 pythermostat/plot.py | 0 pythermostat/test.py | 0 4 files changed, 14 insertions(+) mode change 100644 => 100755 pythermostat/autotune.py mode change 100644 => 100755 pythermostat/plot.py mode change 100644 => 100755 pythermostat/test.py diff --git a/flake.nix b/flake.nix index ad432c6..bd9882a 100644 --- a/flake.nix +++ b/flake.nix @@ -68,6 +68,19 @@ matplotlib ]; }; + + pythermostat-dev-wrappers = pkgs.runCommandNoCC "pythermostat-dev-wrappers" { } '' + mkdir -p $out/bin + for program in ${self}/pythermostat/*.py; do + if [ -x $program ]; then + progname=`basename -s .py $program` + outname=$out/bin/$progname + echo "#!${pkgs.bash}/bin/bash" >> $outname + echo "exec python3 -m $progname \"\$@\"" >> $outname + chmod 755 $outname + fi + done + ''; in { packages.x86_64-linux = { @@ -89,6 +102,7 @@ openocd dfu-util rlwrap + pythermostat-dev-wrappers ] ++ (with python3Packages; [ numpy diff --git a/pythermostat/autotune.py b/pythermostat/autotune.py old mode 100644 new mode 100755 diff --git a/pythermostat/plot.py b/pythermostat/plot.py old mode 100644 new mode 100755 diff --git a/pythermostat/test.py b/pythermostat/test.py old mode 100644 new mode 100755