nix: simplify

This commit is contained in:
occheung 2020-09-30 15:57:46 +08:00
parent 430fc12f54
commit d202886753

View File

@ -8,28 +8,10 @@ let
rustPlatform = callPackage ./nix/rustPlatform.nix {}; rustPlatform = callPackage ./nix/rustPlatform.nix {};
itm = callPackage ./nix/itm.nix {inherit rustPlatform;}; itm = callPackage ./nix/itm.nix {inherit rustPlatform;};
runOpenOcd = writeShellScriptBin "run-openocd" ''
openocd \
-f openocd/openocd.cfg \
-c init &
sleep 1
'';
runOpenOcdBlock = writeShellScriptBin "run-openocd-block" '' runOpenOcdBlock = writeShellScriptBin "run-openocd-block" ''
openocd -f openocd/openocd.cfg openocd -f openocd/openocd.cfg
''; '';
setGDBConfigFile = writeShellScriptBin "set-gdb-config-file" ''
if [[ $1 == "" ]]
then
sed -i "2s/.*/runner = \"gdb -q -x gdb_config\/openocd.gdb\"/" .cargo/config
echo "GDB config file: openocd.gdb"
else
sed -i "2s/.*/runner = \"gdb -q -x gdb_config\/$1.gdb\"/" .cargo/config
echo "GDB config file: $1.gdb"
fi
'';
openocdFlash = writeShellScriptBin "openocd-flash" '' openocdFlash = writeShellScriptBin "openocd-flash" ''
openocd -f openocd/openocd.cfg -f openocd/$1.cfg openocd -f openocd/openocd.cfg -f openocd/$1.cfg
''; '';
@ -40,7 +22,7 @@ let
in in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "nix-shell"; name = "Humpback-DDS";
buildInputs = with rustPlatform.rust; [ buildInputs = with rustPlatform.rust; [
(pkgs.python3.withPackages(ps: [ migen ])) (pkgs.python3.withPackages(ps: [ migen ]))
pkgs.yosys pkgs.yosys
@ -52,9 +34,7 @@ in
rustc rustc
cargo cargo
itm itm
runOpenOcd
runOpenOcdBlock runOpenOcdBlock
setGDBConfigFile
openocdFlash openocdFlash
publishMqtt publishMqtt
]; ];