From 1a3c831a06da40224279d966867dd343caf8f6fd Mon Sep 17 00:00:00 2001 From: atse Date: Fri, 23 Aug 2024 11:30:16 +0800 Subject: [PATCH] flake: Introduce PyThermostat scripts to devShell Make Python scripts in PyThermostat available in the development shell (thermostat_plot, thermostat_autotune, and thermostat_test). --- flake.nix | 14 ++++++++++++++ pythermostat/pythermostat/autotune.py | 0 pythermostat/pythermostat/plot.py | 0 pythermostat/pythermostat/test.py | 0 4 files changed, 14 insertions(+) mode change 100644 => 100755 pythermostat/pythermostat/autotune.py mode change 100644 => 100755 pythermostat/pythermostat/plot.py mode change 100644 => 100755 pythermostat/pythermostat/test.py diff --git a/flake.nix b/flake.nix index f342daf..416bc39 100644 --- a/flake.nix +++ b/flake.nix @@ -69,6 +69,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/thermostat_$progname + echo "#!${pkgs.bash}/bin/bash" >> $outname + echo "exec python -m $progname \"\$@\"" >> $outname + chmod 755 $outname + fi + done + ''; in { packages.x86_64-linux = { @@ -90,6 +103,7 @@ openocd dfu-util rlwrap + pythermostat-dev-wrappers ] ++ (with python3Packages; [ numpy diff --git a/pythermostat/pythermostat/autotune.py b/pythermostat/pythermostat/autotune.py old mode 100644 new mode 100755 diff --git a/pythermostat/pythermostat/plot.py b/pythermostat/pythermostat/plot.py old mode 100644 new mode 100755 diff --git a/pythermostat/pythermostat/test.py b/pythermostat/pythermostat/test.py old mode 100644 new mode 100755