Compare commits

...

2 Commits

Author SHA1 Message Date
d815a9ae55 flake: Add pytec runnables to devShell
Makes it possible to directly run `autotune`, `plot` and `test` in the
devShell.
2024-11-18 18:02:48 +08:00
c9defac87c flake: Introduce pytec to PYTHONPATH in devShell
For easier testing of pytec client code in the shell.
2024-11-18 18:02:29 +08:00
4 changed files with 21 additions and 5 deletions

View File

@ -63,12 +63,24 @@
version = "0.0.0"; version = "0.0.0";
src = "${self}/pythermostat"; src = "${self}/pythermostat";
propagatedBuildInputs = propagatedBuildInputs = with pkgs.python3Packages; [
with pkgs.python3Packages; [
numpy numpy
matplotlib 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 in
{ {
packages.x86_64-linux = { packages.x86_64-linux = {
@ -90,11 +102,15 @@
openocd openocd
dfu-util dfu-util
rlwrap rlwrap
pythermostat-dev-wrappers
] ]
++ (with python3Packages; [ ++ (with python3Packages; [
numpy numpy
matplotlib matplotlib
]); ]);
shellHook = ''
export PYTHONPATH=`git rev-parse --show-toplevel`/pythermostat:$PYTHONPATH
'';
}; };
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style; formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style;

0
pythermostat/autotune.py Normal file → Executable file
View File

0
pythermostat/plot.py Normal file → Executable file
View File

0
pythermostat/test.py Normal file → Executable file
View File