From dec885c896813f52c1037fa56046d4537a86337c Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 17 Mar 2020 19:43:22 +0800 Subject: [PATCH] set stabilizer IP address within M-Labs network --- nixbld-etc-nixos/configuration.nix | 1 + stm32/default.nix | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/nixbld-etc-nixos/configuration.nix b/nixbld-etc-nixos/configuration.nix index 0c1bb37..3f62053 100644 --- a/nixbld-etc-nixos/configuration.nix +++ b/nixbld-etc-nixos/configuration.nix @@ -142,6 +142,7 @@ in address=/sayma/192.168.1.60 address=/kasli/192.168.1.70 address=/kasli-customer/192.168.1.75 + address=/stabilizer-customer/192.168.1.76 # uTCA MCH from NAT address=/tschernobyl/192.168.1.80 ''; diff --git a/stm32/default.nix b/stm32/default.nix index b93d957..0e8ed53 100644 --- a/stm32/default.nix +++ b/stm32/default.nix @@ -8,7 +8,7 @@ let rustPlatform = pkgs.recurseIntoAttrs (pkgs.callPackage ./rustPlatform.nix { inherit rustManifest; }); - buildStm32Firmware = { name, src }: + buildStm32Firmware = { name, src, patchPhase ? "" }: let cargoSha256Drv = pkgs.runCommand "${name}-cargosha256" { } ''cp "${src}/cargosha256.nix" $out''; in @@ -19,6 +19,7 @@ let inherit src; cargoSha256 = (import cargoSha256Drv); + inherit patchPhase; buildPhase = '' export CARGO_HOME=$(mktemp -d cargo-home.XXX) cargo build --release @@ -36,6 +37,11 @@ in stabilizer = buildStm32Firmware { name = "stabilizer"; src = ; + 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 { name = "thermostat";