1
0
Fork 0

set stabilizer IP address within M-Labs network

This commit is contained in:
Sebastien Bourdeauducq 2020-03-17 19:43:22 +08:00
parent b72369d457
commit dec885c896
2 changed files with 8 additions and 1 deletions

View File

@ -142,6 +142,7 @@ in
address=/sayma/192.168.1.60 address=/sayma/192.168.1.60
address=/kasli/192.168.1.70 address=/kasli/192.168.1.70
address=/kasli-customer/192.168.1.75 address=/kasli-customer/192.168.1.75
address=/stabilizer-customer/192.168.1.76
# uTCA MCH from NAT # uTCA MCH from NAT
address=/tschernobyl/192.168.1.80 address=/tschernobyl/192.168.1.80
''; '';

View File

@ -8,7 +8,7 @@ let
rustPlatform = pkgs.recurseIntoAttrs (pkgs.callPackage ./rustPlatform.nix { rustPlatform = pkgs.recurseIntoAttrs (pkgs.callPackage ./rustPlatform.nix {
inherit rustManifest; inherit rustManifest;
}); });
buildStm32Firmware = { name, src }: buildStm32Firmware = { name, src, patchPhase ? "" }:
let let
cargoSha256Drv = pkgs.runCommand "${name}-cargosha256" { } ''cp "${src}/cargosha256.nix" $out''; cargoSha256Drv = pkgs.runCommand "${name}-cargosha256" { } ''cp "${src}/cargosha256.nix" $out'';
in in
@ -19,6 +19,7 @@ let
inherit src; inherit src;
cargoSha256 = (import cargoSha256Drv); cargoSha256 = (import cargoSha256Drv);
inherit patchPhase;
buildPhase = '' buildPhase = ''
export CARGO_HOME=$(mktemp -d cargo-home.XXX) export CARGO_HOME=$(mktemp -d cargo-home.XXX)
cargo build --release cargo build --release
@ -36,6 +37,11 @@ in
stabilizer = buildStm32Firmware { stabilizer = buildStm32Firmware {
name = "stabilizer"; name = "stabilizer";
src = <stabilizerSrc>; src = <stabilizerSrc>;
patchPhase = ''
substituteInPlace src/main.rs \
--replace "let local_addr = net::wire::IpAddress::v4(10, 0, 16, 99);" \
"let local_addr = net::wire::IpAddress::v4(192, 168, 1, 76);"
'';
}; };
thermostat = buildStm32Firmware { thermostat = buildStm32Firmware {
name = "thermostat"; name = "thermostat";