From 5bea19be3653e372ca663d5ab0a8a2be573f150c 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 `plot` and `autotune` in the shell. --- flake.nix | 14 ++++++++++++++ pytec/autotune.py | 0 pytec/plot.py | 0 3 files changed, 14 insertions(+) mode change 100644 => 100755 pytec/autotune.py mode change 100644 => 100755 pytec/plot.py diff --git a/flake.nix b/flake.nix index 42d143a..f850a20 100644 --- a/flake.nix +++ b/flake.nix @@ -49,6 +49,19 @@ dontFixup = true; auditable = false; }; + + pytec-dev-wrappers = pkgs.runCommandNoCC "pytec-dev-wrappers" { } '' + mkdir -p $out/bin + for program in ${self}/pytec/*.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 = { inherit thermostat; @@ -64,6 +77,7 @@ packages = with pkgs; [ rust llvm openocd dfu-util rlwrap + pytec-dev-wrappers ] ++ (with python3Packages; [ numpy matplotlib ]); diff --git a/pytec/autotune.py b/pytec/autotune.py old mode 100644 new mode 100755 diff --git a/pytec/plot.py b/pytec/plot.py old mode 100644 new mode 100755